Commit df14afee authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French

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: 74d7970f ("ksmbd: fix racy issue from using ->d_parent and ->d_name")
Reported-by: default avatarCoverity Scan <scan-admin@coverity.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 48b47f0c
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment