mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
ksmbd: fix sd_ndr.data memory leak in ksmbd_vfs_set_sd_xattr
ndr_encode_v4_ntacl() allocates sd_ndr.data via kzalloc() at entry. If any subsequent ndr_write_*() call returns error during encoding, the allocated sd_ndr.data won't be freed and causes memory leak. Move kfree(sd_ndr.data) into out label to ensure the buffer gets released on all success and error return paths. Signed-off-by: Qiang Liu <liuqiang@kylinos.cn> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
dc59e4fea9
commit
d4d56b00c7
|
|
@ -1487,8 +1487,8 @@ int ksmbd_vfs_set_sd_xattr(struct ksmbd_conn *conn,
|
|||
if (rc < 0)
|
||||
pr_err("Failed to store XATTR ntacl :%d\n", rc);
|
||||
|
||||
kfree(sd_ndr.data);
|
||||
out:
|
||||
kfree(sd_ndr.data);
|
||||
kfree(acl_ndr.data);
|
||||
kfree(smb_acl);
|
||||
kfree(def_smb_acl);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user