Skip to content

Commit

Permalink
mptcp: drop port parameter of mptcp_pm_add_addr_signal
Browse files Browse the repository at this point in the history
[ Upstream commit af7939f ]

Drop the port parameter of mptcp_pm_add_addr_signal() and reflect it to
avoid passing too many parameters.

Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Stable-dep-of: cbb26f7 ("mptcp: fix TCP options overflow.")
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
geliangtang authored and Sasha Levin committed Jan 20, 2025
1 parent 182a57a commit 2fa949c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions net/mptcp/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
bool drop_other_suboptions = false;
unsigned int opt_size = *size;
bool echo;
bool port;
int len;

/* add addr will strip the existing options, be sure to avoid breaking
Expand All @@ -660,12 +659,12 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
if (!mptcp_pm_should_add_signal(msk) ||
(opts->suboptions & (OPTION_MPTCP_MPJ_ACK | OPTION_MPTCP_MPC_ACK)) ||
!mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, &opts->addr,
&echo, &port, &drop_other_suboptions))
&echo, &drop_other_suboptions))
return false;

if (drop_other_suboptions)
remaining += opt_size;
len = mptcp_add_addr_len(opts->addr.family, echo, port);
len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port);
if (remaining < len)
return false;

Expand Down
7 changes: 4 additions & 3 deletions net/mptcp/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
unsigned int opt_size, unsigned int remaining,
struct mptcp_addr_info *addr, bool *echo,
bool *port, bool *drop_other_suboptions)
bool *drop_other_suboptions)
{
int ret = false;
u8 add_addr;
u8 family;
bool port;

spin_lock_bh(&msk->pm.lock);

Expand All @@ -287,10 +288,10 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
}

*echo = mptcp_pm_should_add_signal_echo(msk);
*port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port);
port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port);

family = *echo ? msk->pm.remote.family : msk->pm.local.family;
if (remaining < mptcp_add_addr_len(family, *echo, *port))
if (remaining < mptcp_add_addr_len(family, *echo, port))
goto out_unlock;

if (*echo) {
Expand Down
2 changes: 1 addition & 1 deletion net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list)
bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
unsigned int opt_size, unsigned int remaining,
struct mptcp_addr_info *addr, bool *echo,
bool *port, bool *drop_other_suboptions);
bool *drop_other_suboptions);
bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
struct mptcp_rm_list *rm_list);
int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
Expand Down

0 comments on commit 2fa949c

Please sign in to comment.