]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ksmbd: fix a missing return value check bug
authorWentao Liang <liangwentao@iscas.ac.cn>
Mon, 23 Dec 2024 15:30:50 +0000 (23:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2025 12:34:40 +0000 (13:34 +0100)
commitee7e40f7fb17f08a8cbae50553e5c2e10ae32fce
tree43d90a9f2266c44c1acb40729272daf83a0a2b29
parentf05f5ab5e798b9831b2a1d5fd745eb84c8c1455b
ksmbd: fix a missing return value check bug

[ Upstream commit 4c16e1cadcbcaf3c82d5fc310fbd34d0f5d0db7c ]

In the smb2_send_interim_resp(), if ksmbd_alloc_work_struct()
fails to allocate a node, it returns a NULL pointer to the
in_work pointer. This can lead to an illegal memory write of
in_work->response_buf when allocate_interim_rsp_buf() attempts
to perform a kzalloc() on it.

To address this issue, incorporating a check for the return
value of ksmbd_alloc_work_struct() ensures that the function
returns immediately upon allocation failure, thereby preventing
the aforementioned illegal memory access.

Fixes: 041bba4414cd ("ksmbd: fix wrong interim response on compound")
Signed-off-by: Wentao Liang <liangwentao@iscas.ac.cn>
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/smb2pdu.c