]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ksmbd: fix memory leak in parse_lease_state()
authorWang Zhaolong <wangzhaolong1@huawei.com>
Wed, 30 Apr 2025 03:16:23 +0000 (11:16 +0800)
committerSteve French <stfrench@microsoft.com>
Thu, 1 May 2025 23:58:48 +0000 (18:58 -0500)
commiteb4447bcce915b43b691123118893fca4f372a8f
tree0e4af178e014c44e53b22c05903d15e2f9cc69b0
parent53e3e5babc0963a92d856a5ec0ce92c59f54bc12
ksmbd: fix memory leak in parse_lease_state()

The previous patch that added bounds check for create lease context
introduced a memory leak. When the bounds check fails, the function
returns NULL without freeing the previously allocated lease_ctx_info
structure.

This patch fixes the issue by adding kfree(lreq) before returning NULL
in both boundary check cases.

Fixes: bab703ed8472 ("ksmbd: add bounds check for create lease context")
Signed-off-by: Wang Zhaolong <wangzhaolong1@huawei.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/oplock.c