mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ksmbd: set NegotiateContextCount once instead of every inc
[ Upstream commit 34e8ccf9ce ]
There are no early returns, so marshalling the incremented
NegotiateContextCount with every context is unnecessary.
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8d271ef5e5
commit
2182d96ec0
@@ -847,7 +847,6 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
|
|||||||
"assemble SMB2_PREAUTH_INTEGRITY_CAPABILITIES context\n");
|
"assemble SMB2_PREAUTH_INTEGRITY_CAPABILITIES context\n");
|
||||||
build_preauth_ctxt((struct smb2_preauth_neg_context *)pneg_ctxt,
|
build_preauth_ctxt((struct smb2_preauth_neg_context *)pneg_ctxt,
|
||||||
conn->preauth_info->Preauth_HashId);
|
conn->preauth_info->Preauth_HashId);
|
||||||
rsp->NegotiateContextCount = cpu_to_le16(neg_ctxt_cnt);
|
|
||||||
inc_rfc1001_len(smb2_buf_len, AUTH_GSS_PADDING);
|
inc_rfc1001_len(smb2_buf_len, AUTH_GSS_PADDING);
|
||||||
ctxt_size = sizeof(struct smb2_preauth_neg_context);
|
ctxt_size = sizeof(struct smb2_preauth_neg_context);
|
||||||
/* Round to 8 byte boundary */
|
/* Round to 8 byte boundary */
|
||||||
@@ -859,7 +858,7 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
|
|||||||
"assemble SMB2_ENCRYPTION_CAPABILITIES context\n");
|
"assemble SMB2_ENCRYPTION_CAPABILITIES context\n");
|
||||||
build_encrypt_ctxt((struct smb2_encryption_neg_context *)pneg_ctxt,
|
build_encrypt_ctxt((struct smb2_encryption_neg_context *)pneg_ctxt,
|
||||||
conn->cipher_type);
|
conn->cipher_type);
|
||||||
rsp->NegotiateContextCount = cpu_to_le16(++neg_ctxt_cnt);
|
neg_ctxt_cnt++;
|
||||||
ctxt_size += sizeof(struct smb2_encryption_neg_context) + 2;
|
ctxt_size += sizeof(struct smb2_encryption_neg_context) + 2;
|
||||||
/* Round to 8 byte boundary */
|
/* Round to 8 byte boundary */
|
||||||
pneg_ctxt +=
|
pneg_ctxt +=
|
||||||
@@ -874,7 +873,7 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
|
|||||||
/* Temporarily set to SMB3_COMPRESS_NONE */
|
/* Temporarily set to SMB3_COMPRESS_NONE */
|
||||||
build_compression_ctxt((struct smb2_compression_capabilities_context *)pneg_ctxt,
|
build_compression_ctxt((struct smb2_compression_capabilities_context *)pneg_ctxt,
|
||||||
conn->compress_algorithm);
|
conn->compress_algorithm);
|
||||||
rsp->NegotiateContextCount = cpu_to_le16(++neg_ctxt_cnt);
|
neg_ctxt_cnt++;
|
||||||
ctxt_size += sizeof(struct smb2_compression_capabilities_context) + 2;
|
ctxt_size += sizeof(struct smb2_compression_capabilities_context) + 2;
|
||||||
/* Round to 8 byte boundary */
|
/* Round to 8 byte boundary */
|
||||||
pneg_ctxt += round_up(sizeof(struct smb2_compression_capabilities_context) + 2,
|
pneg_ctxt += round_up(sizeof(struct smb2_compression_capabilities_context) + 2,
|
||||||
@@ -886,7 +885,7 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
|
|||||||
ksmbd_debug(SMB,
|
ksmbd_debug(SMB,
|
||||||
"assemble SMB2_POSIX_EXTENSIONS_AVAILABLE context\n");
|
"assemble SMB2_POSIX_EXTENSIONS_AVAILABLE context\n");
|
||||||
build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt);
|
build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt);
|
||||||
rsp->NegotiateContextCount = cpu_to_le16(++neg_ctxt_cnt);
|
neg_ctxt_cnt++;
|
||||||
ctxt_size += sizeof(struct smb2_posix_neg_context);
|
ctxt_size += sizeof(struct smb2_posix_neg_context);
|
||||||
/* Round to 8 byte boundary */
|
/* Round to 8 byte boundary */
|
||||||
pneg_ctxt += round_up(sizeof(struct smb2_posix_neg_context), 8);
|
pneg_ctxt += round_up(sizeof(struct smb2_posix_neg_context), 8);
|
||||||
@@ -898,10 +897,11 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
|
|||||||
"assemble SMB2_SIGNING_CAPABILITIES context\n");
|
"assemble SMB2_SIGNING_CAPABILITIES context\n");
|
||||||
build_sign_cap_ctxt((struct smb2_signing_capabilities *)pneg_ctxt,
|
build_sign_cap_ctxt((struct smb2_signing_capabilities *)pneg_ctxt,
|
||||||
conn->signing_algorithm);
|
conn->signing_algorithm);
|
||||||
rsp->NegotiateContextCount = cpu_to_le16(++neg_ctxt_cnt);
|
neg_ctxt_cnt++;
|
||||||
ctxt_size += sizeof(struct smb2_signing_capabilities) + 2;
|
ctxt_size += sizeof(struct smb2_signing_capabilities) + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsp->NegotiateContextCount = cpu_to_le16(neg_ctxt_cnt);
|
||||||
inc_rfc1001_len(smb2_buf_len, ctxt_size);
|
inc_rfc1001_len(smb2_buf_len, ctxt_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user