@@ -376,7 +376,7 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
376376{
377377 const struct ipv6hdr * hdr = (const struct ipv6hdr * )skb -> data ;
378378 const struct tcphdr * th = (struct tcphdr * )(skb -> data + offset );
379- struct net * net = dev_net (skb -> dev );
379+ struct net * net = dev_net_rcu (skb -> dev );
380380 struct request_sock * fastopen ;
381381 struct ipv6_pinfo * np ;
382382 struct tcp_sock * tp ;
@@ -866,16 +866,16 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
866866 int oif , int rst , u8 tclass , __be32 label ,
867867 u32 priority , u32 txhash , struct tcp_key * key )
868868{
869- const struct tcphdr * th = tcp_hdr (skb );
870- struct tcphdr * t1 ;
871- struct sk_buff * buff ;
872- struct flowi6 fl6 ;
873- struct net * net = sk ? sock_net (sk ) : dev_net (skb_dst (skb )-> dev );
874- struct sock * ctl_sk = net -> ipv6 .tcp_sk ;
869+ struct net * net = sk ? sock_net (sk ) : dev_net_rcu (skb_dst (skb )-> dev );
875870 unsigned int tot_len = sizeof (struct tcphdr );
871+ struct sock * ctl_sk = net -> ipv6 .tcp_sk ;
872+ const struct tcphdr * th = tcp_hdr (skb );
876873 __be32 mrst = 0 , * topt ;
877874 struct dst_entry * dst ;
878- __u32 mark = 0 ;
875+ struct sk_buff * buff ;
876+ struct tcphdr * t1 ;
877+ struct flowi6 fl6 ;
878+ u32 mark = 0 ;
879879
880880 if (tsecr )
881881 tot_len += TCPOLEN_TSTAMP_ALIGNED ;
@@ -1041,7 +1041,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb,
10411041 if (!sk && !ipv6_unicast_destination (skb ))
10421042 return ;
10431043
1044- net = sk ? sock_net (sk ) : dev_net (skb_dst (skb )-> dev );
1044+ net = sk ? sock_net (sk ) : dev_net_rcu (skb_dst (skb )-> dev );
10451045 /* Invalid TCP option size or twice included auth */
10461046 if (tcp_parse_auth_options (th , & md5_hash_location , & aoh ))
10471047 return ;
@@ -1740,6 +1740,7 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr,
17401740
17411741INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv (struct sk_buff * skb )
17421742{
1743+ struct net * net = dev_net_rcu (skb -> dev );
17431744 enum skb_drop_reason drop_reason ;
17441745 int sdif = inet6_sdif (skb );
17451746 int dif = inet6_iif (skb );
@@ -1749,7 +1750,6 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
17491750 bool refcounted ;
17501751 int ret ;
17511752 u32 isn ;
1752- struct net * net = dev_net (skb -> dev );
17531753
17541754 drop_reason = SKB_DROP_REASON_NOT_SPECIFIED ;
17551755 if (skb -> pkt_type != PACKET_HOST )
@@ -2001,7 +2001,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
20012001
20022002void tcp_v6_early_demux (struct sk_buff * skb )
20032003{
2004- struct net * net = dev_net (skb -> dev );
2004+ struct net * net = dev_net_rcu (skb -> dev );
20052005 const struct ipv6hdr * hdr ;
20062006 const struct tcphdr * th ;
20072007 struct sock * sk ;
0 commit comments