mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 18:11:39 +00:00
ksmbd: fix uninitialized pointer read in smb2_create_link()
[ Upstream commitdf14afeed2
] 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:74d7970feb
("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: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6d4e21e369
commit
30a1344198
1 changed files with 3 additions and 3 deletions
|
@ -5559,7 +5559,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) +
|
||||
|
@ -5592,8 +5592,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) {
|
||||
|
|
Loading…
Reference in a new issue