ksmbd: remove unused compression negotiate ctx packing
authorDavid Disseldorp <ddiss@suse.de>
Tue, 4 Apr 2023 14:29:54 +0000 (16:29 +0200)
committerSteve French <stfrench@microsoft.com>
Mon, 24 Apr 2023 05:09:10 +0000 (00:09 -0500)
commitaf36c51e0e111de4e908328d49cba49de758f66e
treec8c758db85fa296bd620c30f2f37e02cf5506036
parenta12a07a85aff72e19520328f78b1c64d2281a1ec
ksmbd: remove unused compression negotiate ctx packing

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>
fs/ksmbd/smb2pdu.c