From: Florian Westphal <fw@strlen.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Florian Westphal <fw@strlen.de>, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 2/8] rtnetlink: add rtnl_register_module
Date: Mon, 13 Nov 2017 08:21:59 +0100 [thread overview]
Message-ID: <20171113072159.GN5512@breakpoint.cc> (raw)
In-Reply-To: <20171107145736.GN3165@worktop.lehotels.local>
Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Nov 07, 2017 at 10:47:51AM +0100, Florian Westphal wrote:
> > I would expect this to trigger all the time, due to
> >
> > rtnl_register(AF_INET, RTM_GETROUTE, ...
> > rtnl_register(AF_INET, RTM_GETADDR, ...
>
> Ah, sure, then something like so then...
>
> There's bound to be bugs there too, as I pretty much typed this without
> thinking, but it should show the idea.
Just o let you know, I am backlogged at the moment so I Will not have
time to work on this for the time being.
> ---
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 5ace48926b19..de1336775602 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -63,6 +63,7 @@ struct rtnl_link {
> rtnl_doit_func doit;
> rtnl_dumpit_func dumpit;
> unsigned int flags;
> + struct rcu_head rcu;
> };
This will need to be split:
struct rtnl_link {
rtnl_doit_func doit;
unsigned int flags;
struct rcu_head rcu;
};
struct rtnl_link_dump {
rtnl_dumpit_func dumpit;
struct rcu_head rcu;
};
> -static struct rtnl_link __rcu *rtnl_msg_handlers[RTNL_FAMILY_MAX + 1];
> +static struct rtnl_link __rcu **rtnl_msg_handlers[RTNL_FAMILY_MAX + 1];
So this will need to be two arrays.
Reason is that some places do this:
rtnl_register(pf, RTM_FOO, doit, NULL, 0);
rtnl_register(pf, RTM_FOO, NULL, dumpit, 0);
(from different call sites in the stack).
> - if (doit)
> - tab[msgindex].doit = doit;
> - if (dumpit)
> - tab[msgindex].dumpit = dumpit;
Which is the reason for these if () tests.
next prev parent reply other threads:[~2017-11-13 7:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 10:51 rtnetlink: fix dump+module unload races, take 2 Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 1/8] rtnetlink: Revert "rtnetlink: add reference counting to prevent module unload while dump is in progress" Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 2/8] rtnetlink: add rtnl_register_module Florian Westphal
2017-11-06 12:44 ` Peter Zijlstra
2017-11-07 6:11 ` Florian Westphal
2017-11-07 9:10 ` Peter Zijlstra
2017-11-07 9:24 ` Peter Zijlstra
2017-11-07 9:47 ` Florian Westphal
2017-11-07 14:57 ` Peter Zijlstra
2017-11-08 1:27 ` Stephen Hemminger
2017-11-13 7:21 ` Florian Westphal [this message]
2017-11-13 7:55 ` Peter Zijlstra
2017-11-13 7:59 ` Florian Westphal
2017-11-07 9:43 ` Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 3/8] qtr: use rtnl_register_module Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 4/8] bridge: " Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 5/8] can: " Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 6/8] decnet: " Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 7/8] phonet: " Florian Westphal
2017-11-06 10:51 ` [PATCH net-next 8/8] mpls: " Florian Westphal
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=20171113072159.GN5512@breakpoint.cc \
--to=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.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).