Skip to content

Commit 0154b94

Browse files
committed
Merge branch 'mptcp-fixes-addressing-syzbot-reports'
Matthieu Baerts says: ==================== mptcp: fixes addressing syzbot reports Recently, a few issues linked to MPTCP have been reported by syzbot. All the remaining ones are addressed in this series. - Patch 1: Address "KMSAN: uninit-value in mptcp_incoming_options (2)". A fix for v5.11. - Patch 2: Address "WARNING in mptcp_pm_nl_set_flags (2)". A fix for v5.18. - Patch 3: Address "WARNING in __mptcp_clean_una (2)". A fix for v6.4, backported up to v6.1. ==================== Link: https://patch.msgid.link/20250123-net-mptcp-syzbot-issues-v1-0-af73258a726f@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 19e65c4 + 619af16 commit 0154b94

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

net/mptcp/options.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ static void mptcp_parse_option(const struct sk_buff *skb,
108108
mp_opt->suboptions |= OPTION_MPTCP_DSS;
109109
mp_opt->use_map = 1;
110110
mp_opt->mpc_map = 1;
111-
mp_opt->use_ack = 0;
112111
mp_opt->data_len = get_unaligned_be16(ptr);
113112
ptr += 2;
114113
}
@@ -157,11 +156,6 @@ static void mptcp_parse_option(const struct sk_buff *skb,
157156
pr_debug("DSS\n");
158157
ptr++;
159158

160-
/* we must clear 'mpc_map' be able to detect MP_CAPABLE
161-
* map vs DSS map in mptcp_incoming_options(), and reconstruct
162-
* map info accordingly
163-
*/
164-
mp_opt->mpc_map = 0;
165159
flags = (*ptr++) & MPTCP_DSS_FLAG_MASK;
166160
mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0;
167161
mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0;
@@ -369,8 +363,11 @@ void mptcp_get_options(const struct sk_buff *skb,
369363
const unsigned char *ptr;
370364
int length;
371365

372-
/* initialize option status */
373-
mp_opt->suboptions = 0;
366+
/* Ensure that casting the whole status to u32 is efficient and safe */
367+
BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32));
368+
BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status),
369+
sizeof(u32)));
370+
*(u32 *)&mp_opt->status = 0;
374371

375372
length = (th->doff * 4) - sizeof(struct tcphdr);
376373
ptr = (const unsigned char *)(th + 1);

net/mptcp/pm_netlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,8 @@ int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info)
20202020
return -EINVAL;
20212021
}
20222022
if ((addr.flags & MPTCP_PM_ADDR_FLAG_FULLMESH) &&
2023-
(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {
2023+
(entry->flags & (MPTCP_PM_ADDR_FLAG_SIGNAL |
2024+
MPTCP_PM_ADDR_FLAG_IMPLICIT))) {
20242025
spin_unlock_bh(&pernet->lock);
20252026
GENL_SET_ERR_MSG(info, "invalid addr flags");
20262027
return -EINVAL;

net/mptcp/protocol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,8 +1767,10 @@ static int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
17671767
* see mptcp_disconnect().
17681768
* Attempt it again outside the problematic scope.
17691769
*/
1770-
if (!mptcp_disconnect(sk, 0))
1770+
if (!mptcp_disconnect(sk, 0)) {
1771+
sk->sk_disconnects++;
17711772
sk->sk_socket->state = SS_UNCONNECTED;
1773+
}
17721774
}
17731775
inet_clear_bit(DEFER_CONNECT, sk);
17741776

net/mptcp/protocol.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,24 @@ struct mptcp_options_received {
149149
u32 subflow_seq;
150150
u16 data_len;
151151
__sum16 csum;
152-
u16 suboptions;
152+
struct_group(status,
153+
u16 suboptions;
154+
u16 use_map:1,
155+
dsn64:1,
156+
data_fin:1,
157+
use_ack:1,
158+
ack64:1,
159+
mpc_map:1,
160+
reset_reason:4,
161+
reset_transient:1,
162+
echo:1,
163+
backup:1,
164+
deny_join_id0:1,
165+
__unused:2;
166+
);
167+
u8 join_id;
153168
u32 token;
154169
u32 nonce;
155-
u16 use_map:1,
156-
dsn64:1,
157-
data_fin:1,
158-
use_ack:1,
159-
ack64:1,
160-
mpc_map:1,
161-
reset_reason:4,
162-
reset_transient:1,
163-
echo:1,
164-
backup:1,
165-
deny_join_id0:1,
166-
__unused:2;
167-
u8 join_id;
168170
u64 thmac;
169171
u8 hmac[MPTCPOPT_HMAC_LEN];
170172
struct mptcp_addr_info addr;

0 commit comments

Comments
 (0)