Skip to content

Commit 05ba00d

Browse files
geliangtanggregkh
authored andcommitted
mptcp: drop port parameter of mptcp_pm_add_addr_signal
[ 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 <geliang.tang@suse.com> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: cbb26f7 ("mptcp: fix TCP options overflow.") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f44e6d7 commit 05ba00d

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

net/mptcp/options.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
651651
bool drop_other_suboptions = false;
652652
unsigned int opt_size = *size;
653653
bool echo;
654-
bool port;
655654
int len;
656655

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

666665
if (drop_other_suboptions)
667666
remaining += opt_size;
668-
len = mptcp_add_addr_len(opts->addr.family, echo, port);
667+
len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port);
669668
if (remaining < len)
670669
return false;
671670

net/mptcp/pm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,12 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
265265
bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
266266
unsigned int opt_size, unsigned int remaining,
267267
struct mptcp_addr_info *addr, bool *echo,
268-
bool *port, bool *drop_other_suboptions)
268+
bool *drop_other_suboptions)
269269
{
270270
int ret = false;
271271
u8 add_addr;
272272
u8 family;
273+
bool port;
273274

274275
spin_lock_bh(&msk->pm.lock);
275276

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

289290
*echo = mptcp_pm_should_add_signal_echo(msk);
290-
*port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port);
291+
port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port);
291292

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

296297
if (*echo) {

net/mptcp/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list)
823823
bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
824824
unsigned int opt_size, unsigned int remaining,
825825
struct mptcp_addr_info *addr, bool *echo,
826-
bool *port, bool *drop_other_suboptions);
826+
bool *drop_other_suboptions);
827827
bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
828828
struct mptcp_rm_list *rm_list);
829829
int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);

0 commit comments

Comments
 (0)