mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
ksmbd: fix n.data memory leak in ksmbd_vfs_set_dos_attrib_xattr
Free ndr buffer data when ndr_encode_dos_attr() returns error to avoid memory leak. 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
d708a36634
commit
7ac657bb9c
|
|
@ -1575,14 +1575,15 @@ int ksmbd_vfs_set_dos_attrib_xattr(struct mnt_idmap *idmap,
|
|||
|
||||
err = ndr_encode_dos_attr(&n, da);
|
||||
if (err)
|
||||
return err;
|
||||
goto out;
|
||||
|
||||
err = ksmbd_vfs_setxattr(idmap, path, XATTR_NAME_DOS_ATTRIBUTE,
|
||||
(void *)n.data, n.offset, 0, get_write);
|
||||
if (err)
|
||||
ksmbd_debug(SMB, "failed to store dos attribute in xattr\n");
|
||||
kfree(n.data);
|
||||
|
||||
out:
|
||||
kfree(n.data);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user