Skip to content

Commit df14afe

Browse files
namjaejeonSteve French
authored andcommitted
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: 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>
1 parent 48b47f0 commit df14afe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5506,7 +5506,7 @@ static int smb2_create_link(struct ksmbd_work *work,
55065506
{
55075507
char *link_name = NULL, *target_name = NULL, *pathname = NULL;
55085508
struct path path;
5509-
bool file_present = true;
5509+
bool file_present = false;
55105510
int rc;
55115511

55125512
if (buf_len < (u64)sizeof(struct smb2_file_link_info) +
@@ -5539,8 +5539,8 @@ static int smb2_create_link(struct ksmbd_work *work,
55395539
if (rc) {
55405540
if (rc != -ENOENT)
55415541
goto out;
5542-
file_present = false;
5543-
}
5542+
} else
5543+
file_present = true;
55445544

55455545
if (file_info->ReplaceIfExists) {
55465546
if (file_present) {

0 commit comments

Comments
 (0)