mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
ksmbd: Fix memory leak in get_file_all_info()
In get_file_all_info(), if vfs_getattr() fails, the function returns
immediately without freeing the allocated filename, leading to a memory
leak.
Fix this by freeing the filename before returning in this error case.
Fixes: 5614c8c487 ("ksmbd: replace generic_fillattr with vfs_getattr")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
f8f9c1f4d0
commit
0c56693b06
|
|
@ -4923,8 +4923,10 @@ static int get_file_all_info(struct ksmbd_work *work,
|
|||
|
||||
ret = vfs_getattr(&fp->filp->f_path, &stat, STATX_BASIC_STATS,
|
||||
AT_STATX_SYNC_AS_STAT);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
kfree(filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ksmbd_debug(SMB, "filename = %s\n", filename);
|
||||
delete_pending = ksmbd_inode_pending_delete(fp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user