]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ksmbd: remove unused compression negotiate ctx packing
authorDavid Disseldorp <ddiss@suse.de>
Sun, 31 Dec 2023 07:12:35 +0000 (16:12 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 14:18:29 +0000 (15:18 +0100)
commit965eb8650737e626544f67545d597895f1ee252b
tree791c7e6b674adbf1fb587cf583e2f0f8c2f6e3ce
parent49d9f6ad1ee064c52662538fc48b2ada33ae3fd2
ksmbd: remove unused compression negotiate ctx packing

[ Upstream commit af36c51e0e111de4e908328d49cba49de758f66e ]

build_compression_ctxt() is currently unreachable due to
conn.compress_algorithm remaining zero (SMB3_COMPRESS_NONE).

It appears to have been broken in a couple of subtle ways over the
years:
- prior to d6c9ad23b421 ("ksmbd: use the common definitions for
  NEGOTIATE_PROTOCOL") smb2_compression_ctx.DataLength was set to 8,
  which didn't account for the single CompressionAlgorithms flexible
  array member.
- post d6c9ad23b421 smb2_compression_capabilities_context
  CompressionAlgorithms is a three member array, while
  CompressionAlgorithmCount is set to indicate only one member.
  assemble_neg_contexts() ctxt_size is also incorrectly incremented by
  sizeof(struct smb2_compression_capabilities_context) + 2, which
  assumes one flexible array member.

Signed-off-by: David Disseldorp <ddiss@suse.de>
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