Skip to content

Commit

Permalink
ksmbd: fix uninitialized pointer read in ksmbd_vfs_rename()
Browse files Browse the repository at this point in the history
commit 48b47f0 upstream.

Uninitialized rd.delegated_inode can be used in vfs_rename().
Fix this by setting rd.delegated_inode to NULL to avoid the uninitialized
read.

Fixes: 74d7970 ("ksmbd: fix racy issue from using ->d_parent and ->d_name")
Reported-by: Coverity Scan <scan-admin@coverity.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Namjae Jeon authored and Greg Kroah-Hartman committed Jun 28, 2023
1 parent 20cb9d4 commit c526418
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/ksmbd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,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);
Expand Down

0 comments on commit c526418

Please sign in to comment.