Message ID | 1426130872.11398.141.camel@edumazet-glaptop2.roam.corp.google.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Wed, 11 Mar 2015 20:27:52 -0700 > From: Eric Dumazet <edumazet@google.com> > > I forgot to use write_pnet() in three locations. > > Signed-off-by: Eric Dumazet <edumazet@google.com> > Fixes: 33cf7c90fe2f9 ("net: add real socket cookies") > Reported-by: kbuild test robot <fengguang.wu@intel.com> Applied, thanks Eric. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
The current usage of write_pnet and read_pnet is a little laborious and error prone as you only notice if you failed to include them if are compiling with network namespaces enabled. possible_net_t remedies that by using a type that is 0 bytes when network namespaces are disabled and can only be read and written to with read_pnet and write_pnet. Aka less work and safer for the same effect. I kill hold_net and release_net first as are they are haven't been used since 2008 and are noise at the points where write_pnet and read_pnet are used. I have folded in Eric Dumazets suggestions to improve the killing of hold_net and release net. And respon. I had to respin anyway as there was enough changes elsewhere in the tree the previous version of these patches did not quite apply cleanly. Eric W. Biederman (2): net: Kill hold_net release_net net: Introduce possible_net_t include/linux/netdevice.h | 9 ++----- include/net/cfg80211.h | 4 +-- include/net/fib_rules.h | 9 +------ include/net/genetlink.h | 4 +-- include/net/inet_hashtables.h | 4 +-- include/net/ip_vs.h | 8 +++--- include/net/neighbour.h | 8 ++---- include/net/net_namespace.h | 52 +++++++++--------------------------- include/net/netfilter/nf_conntrack.h | 5 ++-- include/net/sock.h | 6 ++--- include/net/xfrm.h | 8 ++---- net/9p/trans_fd.c | 4 +-- net/core/dev.c | 2 -- net/core/fib_rules.c | 17 +++--------- net/core/neighbour.c | 9 ++----- net/core/net_namespace.c | 11 -------- net/core/sock.c | 1 - net/ipv4/fib_semantics.c | 3 +-- net/ipv4/inet_hashtables.c | 3 +-- net/ipv4/inet_timewait_sock.c | 3 +-- net/ipv4/ipmr.c | 4 +-- net/ipv6/addrlabel.c | 11 ++------ net/ipv6/ip6_flowlabel.c | 3 +-- net/ipv6/ip6mr.c | 4 +-- net/openvswitch/datapath.c | 4 +-- net/openvswitch/datapath.h | 4 +-- net/packet/internal.h | 4 +-- 27 files changed, 49 insertions(+), 155 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: ebiederm@xmission.com (Eric W. Biederman) Date: Wed, 11 Mar 2015 23:03:13 -0500 > The current usage of write_pnet and read_pnet is a little laborious and > error prone as you only notice if you failed to include them if are > compiling with network namespaces enabled. > > possible_net_t remedies that by using a type that is 0 bytes when > network namespaces are disabled and can only be read and written to with > read_pnet and write_pnet. > > Aka less work and safer for the same effect. > > I kill hold_net and release_net first as are they are haven't been used > since 2008 and are noise at the points where write_pnet and read_pnet > are used. > > I have folded in Eric Dumazets suggestions to improve the killing of > hold_net and release net. And respon. I had to respin anyway as > there was enough changes elsewhere in the tree the previous version > of these patches did not quite apply cleanly. Series applied, thanks! -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 207281ae3536..a78e0b999f96 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -641,7 +641,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ireq = inet_rsk(req); ireq->ir_loc_addr = ip_hdr(skb)->daddr; ireq->ir_rmt_addr = ip_hdr(skb)->saddr; - ireq->ireq_net = sock_net(sk); + write_pnet(&ireq->ireq_net, sock_net(sk)); atomic64_set(&ireq->ir_cookie, 0); /* diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index ece31b426013..18e5a67fda81 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c @@ -346,7 +346,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0; treq->snt_synack = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsecr : 0; treq->listener = NULL; - ireq->ireq_net = sock_net(sk); + write_pnet(&ireq->ireq_net, sock_net(sk)); /* We throwed the options of the initial SYN away, so we hope * the ACK carries the same options again (see RFC1122 4.2.3.8) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d7045f5f6ebf..26f24995bd3d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5965,7 +5965,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; tcp_openreq_init(req, &tmp_opt, skb, sk); - inet_rsk(req)->ireq_net = sock_net(sk); + write_pnet(&inet_rsk(req)->ireq_net, sock_net(sk)); atomic64_set(&inet_rsk(req)->ir_cookie, 0); af_ops->init_req(req, sk, skb);