@@ -156,11 +156,6 @@ static void mptcp_parse_option(const struct sk_buff *skb,
156156 pr_debug ("DSS\n" );
157157 ptr ++ ;
158158
159- /* we must clear 'mpc_map' be able to detect MP_CAPABLE
160- * map vs DSS map in mptcp_incoming_options(), and reconstruct
161- * map info accordingly
162- */
163- mp_opt -> mpc_map = 0 ;
164159 flags = (* ptr ++ ) & MPTCP_DSS_FLAG_MASK ;
165160 mp_opt -> data_fin = (flags & MPTCP_DSS_DATA_FIN ) != 0 ;
166161 mp_opt -> dsn64 = (flags & MPTCP_DSS_DSN64 ) != 0 ;
@@ -368,8 +363,11 @@ void mptcp_get_options(const struct sk_buff *skb,
368363 const unsigned char * ptr ;
369364 int length ;
370365
371- /* initialize option status */
372- 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 ;
373371
374372 length = (th -> doff * 4 ) - sizeof (struct tcphdr );
375373 ptr = (const unsigned char * )(th + 1 );
@@ -606,7 +604,6 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
606604 }
607605 opts -> ext_copy .use_ack = 1 ;
608606 opts -> suboptions = OPTION_MPTCP_DSS ;
609- WRITE_ONCE (msk -> old_wspace , __mptcp_space ((struct sock * )msk ));
610607
611608 /* Add kind/length/subtype/flag overhead if mapping is not populated */
612609 if (dss_size == 0 )
@@ -654,6 +651,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
654651 struct mptcp_sock * msk = mptcp_sk (subflow -> conn );
655652 bool drop_other_suboptions = false;
656653 unsigned int opt_size = * size ;
654+ struct mptcp_addr_info addr ;
657655 bool echo ;
658656 int len ;
659657
@@ -662,7 +660,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
662660 */
663661 if (!mptcp_pm_should_add_signal (msk ) ||
664662 (opts -> suboptions & (OPTION_MPTCP_MPJ_ACK | OPTION_MPTCP_MPC_ACK )) ||
665- !mptcp_pm_add_addr_signal (msk , skb , opt_size , remaining , & opts -> addr ,
663+ !mptcp_pm_add_addr_signal (msk , skb , opt_size , remaining , & addr ,
666664 & echo , & drop_other_suboptions ))
667665 return false;
668666
@@ -675,7 +673,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
675673 else if (opts -> suboptions & OPTION_MPTCP_DSS )
676674 return false;
677675
678- len = mptcp_add_addr_len (opts -> addr .family , echo , !!opts -> addr .port );
676+ len = mptcp_add_addr_len (addr .family , echo , !!addr .port );
679677 if (remaining < len )
680678 return false;
681679
@@ -692,6 +690,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
692690 opts -> ahmac = 0 ;
693691 * size -= opt_size ;
694692 }
693+ opts -> addr = addr ;
695694 opts -> suboptions |= OPTION_MPTCP_ADD_ADDR ;
696695 if (!echo ) {
697696 MPTCP_INC_STATS (sock_net (sk ), MPTCP_MIB_ADDADDRTX );
@@ -1286,7 +1285,7 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
12861285 }
12871286 MPTCP_INC_STATS (sock_net (ssk ), MPTCP_MIB_RCVWNDCONFLICT );
12881287 }
1289- return ;
1288+ goto update_wspace ;
12901289 }
12911290
12921291 if (rcv_wnd_new != rcv_wnd_old ) {
@@ -1311,6 +1310,9 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
13111310 th -> window = htons (new_win );
13121311 MPTCP_INC_STATS (sock_net (ssk ), MPTCP_MIB_RCVWNDSHARED );
13131312 }
1313+
1314+ update_wspace :
1315+ WRITE_ONCE (msk -> old_wspace , tp -> rcv_wnd );
13141316}
13151317
13161318__sum16 __mptcp_make_csum (u64 data_seq , u32 subflow_seq , u16 data_len , __wsum sum )
0 commit comments