]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:21:21 +0000 (08:21 +0200)
commitfacf22c1a394c1e023dab5daf9a494f722771e1c
treea8bb5e00f92700afbe54f88c4d285994dd474a37
parentbca8df998cce1fead8cbc69144862eadc2e34c87
ksmbd: fix memory leak in parse_lease_state()

[ Upstream commit eb4447bcce915b43b691123118893fca4f372a8f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/server/oplock.c