diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2023-05-14 10:02:27 +0900 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-05-26 20:27:46 -0500 |
commit | df14afeed2e6c1bbadef7d2f9c46887bbd6d8d94 (patch) | |
tree | 497780355af0efa37554a3ef6e89399d4c508884 | |
parent | 48b47f0caaa8a9f05ed803cb4f335fa3a7bfc622 (diff) |
ksmbd: fix uninitialized pointer read in smb2_create_link()
There is a case that file_present is true and path is uninitialized.
This patch change file_present is set to false by default and set to
true when patch is initialized.
Fixes: 74d7970febf7 ("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>
-rw-r--r-- | fs/smb/server/smb2pdu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 717bcd20545b..1632b2a1e516 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -5506,7 +5506,7 @@ static int smb2_create_link(struct ksmbd_work *work, { char *link_name = NULL, *target_name = NULL, *pathname = NULL; struct path path; - bool file_present = true; + bool file_present = false; int rc; if (buf_len < (u64)sizeof(struct smb2_file_link_info) + @@ -5539,8 +5539,8 @@ static int smb2_create_link(struct ksmbd_work *work, if (rc) { if (rc != -ENOENT) goto out; - file_present = false; - } + } else + file_present = true; if (file_info->ReplaceIfExists) { if (file_present) { |