Skip to content

Commit 299cd25

Browse files
committed
tgupdate: merge t/DO-NOT-MERGE-git-markup-features-other-trees into t/DO-NOT-MERGE-mptcp-use-kmalloc-on-kasan-build base
2 parents b6ce406 + 1c10833 commit 299cd25

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

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/protocol.h

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

0 commit comments

Comments
 (0)