mbox series

[v4,net,00/12] net: first round to use dev_net_rcu()

Message ID 20250205155120.1676781-1-edumazet@google.com (mailing list archive)
Headers show
Series net: first round to use dev_net_rcu() | expand

Message

Eric Dumazet Feb. 5, 2025, 3:51 p.m. UTC
dev_net(dev) should either be protected by RTNL or RCU.

There is no LOCKDEP support yet for this helper.

Adding it would trigger too many splats.

Instead, add dev_net_rcu() for rcu_read_lock() contexts
and start to use it to fix bugs and clearly document the
safety requirements.

v4: Shrink the series to limit number of potential iterations.
    Fix ip6_input() in a separate patch.
    Link: https://lore.kernel.org/netdev/CANn89i+AozhFhZNK0Y4e_EqXV1=yKjGuvf43Wa6JJKWMOixWQQ@mail.gmail.com/

v3: Rework patches 9 and 10 after Jakub feedback.
    Link: https://lore.kernel.org/netdev/20250203153633.46ce0337@kernel.org/
    Added some missing Fixes tags.

v2: Resend (one patch missed v1 train), plus minor fixes.

Eric Dumazet (12):
  net: add dev_net_rcu() helper
  ipv4: add RCU protection to ip4_dst_hoplimit()
  ipv4: use RCU protection in ip_dst_mtu_maybe_forward()
  ipv4: use RCU protection in ipv4_default_advmss()
  ipv4: use RCU protection in rt_is_expired()
  ipv4: use RCU protection in inet_select_addr()
  ipv4: use RCU protection in __ip_rt_update_pmtu()
  ipv4: icmp: convert to dev_net_rcu()
  flow_dissector: use RCU protection to fetch dev_net()
  ipv6: use RCU protection in ip6_default_advmss()
  ipv6: icmp: convert to dev_net_rcu()
  ipv6: Use RCU in ip6_input()

 include/linux/netdevice.h   |  6 ++++++
 include/net/ip.h            | 13 +++++++++---
 include/net/net_namespace.h |  2 +-
 include/net/route.h         |  9 ++++++--
 net/core/flow_dissector.c   | 21 ++++++++++---------
 net/ipv4/devinet.c          |  3 ++-
 net/ipv4/icmp.c             | 31 ++++++++++++++-------------
 net/ipv4/route.c            | 30 ++++++++++++++++++--------
 net/ipv6/icmp.c             | 42 ++++++++++++++++++++-----------------
 net/ipv6/ip6_input.c        | 14 ++++++++-----
 net/ipv6/route.c            |  7 ++++++-
 11 files changed, 113 insertions(+), 65 deletions(-)