]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ksmbd: fix memory leak in smb2_lock()
authorZizhi Wo <wozizhi@huawei.com>
Fri, 1 Dec 2023 14:50:48 +0000 (22:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 14:17:34 +0000 (15:17 +0100)
commita69d8ee03c880e14401f5ba00347ca607833a3e5
tree51585794bb5a41df0c456bd41e7b5b68867f6a9f
parentfd0d9b167459e6e00e76fbabe2b1d6578af1b9f4
ksmbd: fix memory leak in smb2_lock()

[ Upstream commit 8f1752723019db900fb60a5b9d0dfd3a2bdea36c ]

In smb2_lock(), if setup_async_work() executes successfully,
work->cancel_argv will bind the argv that generated by kmalloc(). And
release_async_work() is called in ksmbd_conn_try_dequeue_request() or
smb2_lock() to release argv.
However, when setup_async_work function fails, work->cancel_argv has not
been bound to the argv, resulting in the previously allocated argv not
being released. Call kfree() to fix it.

Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ksmbd/smb2pdu.c