Please sign in to comment.
inet: add RCU protection to inet->opt
We lack proper synchronization to manipulate inet->opt ip_options Problem is ip_make_skb() calls ip_setup_cork() and ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options), without any protection against another thread manipulating inet->opt. Another thread can change inet->opt pointer and free old one under us. Use RCU to protect inet->opt (changed to inet->inet_opt). Instead of handling atomic refcounts, just copy ip_options when necessary, to avoid cache line dirtying. We cant insert an rcu_head in struct ip_options since its included in skb->cb, so this patch is large because I had to introduce a new ip_options_rcu structure. Signed-off-by: Eric Dumazet <email@example.com> Cc: Herbert Xu <firstname.lastname@example.org> Signed-off-by: David S. Miller <email@example.com>
- Loading branch information...
Showing with 241 additions and 168 deletions.
- +11 −3 include/net/inet_sock.h
- +6 −5 include/net/ip.h
- +10 −6 net/dccp/ipv4.c
- +1 −1 net/dccp/ipv6.c
- +12 −5 net/ipv4/af_inet.c
- +63 −50 net/ipv4/cipso_ipv4.c
- +11 −12 net/ipv4/icmp.c
- +3 −3 net/ipv4/inet_connection_sock.c
- +18 −20 net/ipv4/ip_options.c
- +21 −23 net/ipv4/ip_output.c
- +24 −11 net/ipv4/ip_sockglue.c
- +15 −4 net/ipv4/raw.c
- +2 −2 net/ipv4/syncookies.c
- +20 −14 net/ipv4/tcp_ipv4.c
- +16 −5 net/ipv4/udp.c
- +1 −1 net/ipv6/tcp_ipv6.c
- +7 −3 net/l2tp/l2tp_ip.c
Oops, something went wrong.