Skip to content

Commit 84f19c9

Browse files
matttbeintel-lab-lkp
authored andcommitted
mptcp: pass right struct to subflow_hmac_valid
subflow_hmac_valid() needs to access the MPTCP socket and the subflow request, but not the request sock that is passed in argument. Instead, the subflow request can be directly passed to avoid getting it via an additional cast. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 891df4d commit 84f19c9

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

net/mptcp/subflow.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -745,15 +745,11 @@ struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *op
745745
EXPORT_SYMBOL(mptcp_subflow_reqsk_alloc);
746746

747747
/* validate hmac received in third ACK */
748-
static bool subflow_hmac_valid(const struct request_sock *req,
748+
static bool subflow_hmac_valid(const struct mptcp_subflow_request_sock *subflow_req,
749749
const struct mptcp_options_received *mp_opt)
750750
{
751-
const struct mptcp_subflow_request_sock *subflow_req;
751+
struct mptcp_sock *msk = subflow_req->msk;
752752
u8 hmac[SHA256_DIGEST_SIZE];
753-
struct mptcp_sock *msk;
754-
755-
subflow_req = mptcp_subflow_rsk(req);
756-
msk = subflow_req->msk;
757753

758754
subflow_generate_hmac(READ_ONCE(msk->remote_key),
759755
READ_ONCE(msk->local_key),
@@ -899,7 +895,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
899895
goto dispose_child;
900896
}
901897

902-
if (!subflow_hmac_valid(req, &mp_opt)) {
898+
if (!subflow_hmac_valid(subflow_req, &mp_opt)) {
903899
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
904900
subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
905901
goto dispose_child;

0 commit comments

Comments
 (0)