Subject: CVE-2024-26980: ksmbd: fix slab-out-of-bounds in smb2_allocate_rsp_buf

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: fix slab-out-of-bounds in smb2_allocate_rsp_buf

If ->ProtocolId is SMB2_TRANSFORM_PROTO_NUM, smb2 request size
validation could be skipped. if request size is smaller than
sizeof(struct smb2_query_info_req), slab-out-of-bounds read can happen in
smb2_allocate_rsp_buf(). This patch allocate response buffer after
decrypting transform request. smb3_decrypt_req() will validate transform
request size and avoid slab-out-of-bound in smb2_allocate_rsp_buf().

The Linux kernel CVE team has assigned CVE-2024-26980 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.15.159 with commit da2140137260
	Fixed in 6.1.88 with commit b80ba648714e
	Fixed in 6.6.29 with commit 3160d9734453
	Fixed in 6.8.8 with commit 0977f89722ec
	Fixed in 6.9 with commit c119f4ede3fa

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-26980
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	fs/smb/server/server.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/da21401372607c49972ea87a6edaafb36a17c325
	https://git.kernel.org/stable/c/b80ba648714e6d790d69610cf14656be222d0248
	https://git.kernel.org/stable/c/3160d9734453a40db248487f8204830879c207f1
	https://git.kernel.org/stable/c/0977f89722eceba165700ea384f075143f012085
	https://git.kernel.org/stable/c/c119f4ede3fa90a9463f50831761c28f989bfb20