netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Subject: [PATCH net-next v3] net: add rcu annotations for ifa_list
Date: Fri, 31 May 2019 18:27:02 +0200	[thread overview]
Message-ID: <20190531162709.9895-1-fw@strlen.de> (raw)

v3: fix typo in patch1 commit message
    All other patches are unchanged.
v2: remove ifa_list iteration in afs instead of conversion

Eric Dumazet reported following problem:

  It looks that unless RTNL is held, accessing ifa_list needs proper RCU
  protection.  indev->ifa_list can be changed under us by another cpu
  (which owns RTNL) [..]

  A proper rcu_dereference() with an happy sparse support would require
  adding __rcu attribute.

This patch series does that: add __rcu to the ifa_list pointers.
That makes sparse complain, so the series also adds the required
rcu_assign_pointer/dereference helpers where needed.

All patches except the last one are preparation work.
Two new macros are introduced for in_ifaddr walks.

Last patch adds the __rcu annotations and the assign_pointer/dereference
helper calls.

This patch is a bit large, but I found no better way -- other
approaches (annotate-first or add helpers-first) all result in
mid-series sparse warnings.

This series is submitted vs. net-next rather than net for several
reasons:

1. Its (mostly) compile-tested only
2. 3rd patch changes behaviour wrt. secondary addresses
   (see changelog)
3. The problem exists for a very long time (2004), so it doesn't
   seem to be urgent to fix this -- rcu use to free ifa_list
   predates the git era.

Florian Westphal (7):
      afs: do not send list of client addresses
      net: inetdevice: provide replacement iterators for in_ifaddr walk
      devinet: use in_dev_for_each_ifa_rcu in more places
      netfilter: use in_dev_for_each_ifa_rcu
      net: use new in_dev_ifa iterators
      drivers: use in_dev_for_each_ifa_rtnl/rcu
      net: ipv4: provide __rcu annotation for ifa_list

drivers/infiniband/core/roce_gid_mgmt.c              |    5 
drivers/infiniband/hw/cxgb4/cm.c                     |    9 -
drivers/infiniband/hw/i40iw/i40iw_cm.c               |    7 
drivers/infiniband/hw/i40iw/i40iw_main.c             |    6 
drivers/infiniband/hw/i40iw/i40iw_utils.c            |   12 -
drivers/infiniband/hw/nes/nes.c                      |    8 
drivers/infiniband/hw/usnic/usnic_ib_main.c          |   15 +
drivers/isdn/hysdn/hysdn_net.c                       |    6 
drivers/isdn/i4l/isdn_net.c                          |   20 +-
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c |    8 
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c     |    5 
drivers/net/ethernet/via/via-velocity.h              |    2 
drivers/net/plip/plip.c                              |    4 
drivers/net/vmxnet3/vmxnet3_drv.c                    |   19 +-
drivers/net/wan/hdlc_cisco.c                         |   11 -
drivers/net/wireless/ath/ath6kl/cfg80211.c           |    4 
drivers/net/wireless/marvell/mwifiex/cfg80211.c      |    2 
fs/afs/Makefile                                      |    1 
fs/afs/cmservice.c                                   |   24 --
fs/afs/internal.h                                    |   15 -
fs/afs/netdevices.c                                  |   48 -----
include/linux/inetdevice.h                           |   19 +-
net/core/netpoll.c                                   |   10 -
net/core/pktgen.c                                    |    8 
net/ipv4/devinet.c                                   |  146 ++++++++++-------
net/ipv4/fib_frontend.c                              |   24 +-
net/ipv4/igmp.c                                      |    5 
net/ipv4/netfilter/nf_tproxy_ipv4.c                  |    9 -
net/ipv6/addrconf.c                                  |    4 
net/mac80211/main.c                                  |    4 
net/netfilter/nf_conntrack_broadcast.c               |    9 -
net/netfilter/nf_nat_redirect.c                      |   12 -
net/netfilter/nfnetlink_osf.c                        |    5 
net/sctp/protocol.c                                  |    2 
net/smc/smc_clc.c                                    |   11 -
 35 files changed, 266 insertions(+), 233 deletions(-)



             reply	other threads:[~2019-05-31 16:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 16:27 Florian Westphal [this message]
2019-05-31 16:27 ` [PATCH net-next v3 1/7] afs: do not send list of client addresses Florian Westphal
2019-05-31 16:27 ` [PATCH net-next v3 2/7] net: inetdevice: provide replacement iterators for in_ifaddr walk Florian Westphal
2019-05-31 16:27 ` [PATCH net-next v3 3/7] devinet: use in_dev_for_each_ifa_rcu in more places Florian Westphal
2019-05-31 16:27 ` [PATCH net-next v3 4/7] netfilter: use in_dev_for_each_ifa_rcu Florian Westphal
2019-05-31 16:27 ` [PATCH net-next v3 5/7] net: use new in_dev_ifa iterators Florian Westphal
2019-05-31 16:27 ` [PATCH net-next v3 6/7] drivers: use in_dev_for_each_ifa_rtnl/rcu Florian Westphal
2019-05-31 16:27 ` [PATCH net-next v3 7/7] net: ipv4: provide __rcu annotation for ifa_list Florian Westphal
2019-06-05  0:41   ` [net] c55ca5814f: WARNING:suspicious_RCU_usage kernel test robot
2019-06-17  8:25   ` [PATCH net-next v3 7/7] net: ipv4: provide __rcu annotation for ifa_list Tariq Toukan
2019-06-17  9:25     ` Florian Westphal
2019-06-03  1:11 ` [PATCH net-next v3] net: add rcu annotations " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190531162709.9895-1-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).