diff mbox series

ksmbd: fix uninitialized pointer read in ksmbd_vfs_rename()

Message ID 20230514035142.7653-1-linkinjeon@kernel.org (mailing list archive)
State New, archived
Headers show
Series ksmbd: fix uninitialized pointer read in ksmbd_vfs_rename() | expand

Commit Message

Namjae Jeon May 14, 2023, 3:51 a.m. UTC
Uninitialized rd.delegated_inode can be used in vfs_rename().
Fix this by setting rd.delegated_inode to NULL to avoid the uninitialized
read.

Reported-by: Coverity Scan <scan-admin@coverity.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/ksmbd/vfs.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
index 778c152708e4..9bdb01c5b201 100644
--- a/fs/ksmbd/vfs.c
+++ b/fs/ksmbd/vfs.c
@@ -743,6 +743,7 @@  int ksmbd_vfs_rename(struct ksmbd_work *work, const struct path *old_path,
 	rd.new_dir		= new_path.dentry->d_inode,
 	rd.new_dentry		= new_dentry,
 	rd.flags		= flags,
+	rd.delegated_inode	= NULL,
 	err = vfs_rename(&rd);
 	if (err)
 		ksmbd_debug(VFS, "vfs_rename failed err %d\n", err);