Re: [PATCH] rtnetlink: Synchronze net in rtnl_unregister()

From: Dmitry Safonov
Date: Mon Feb 25 2019 - 19:09:17 EST


On 2/25/19 11:31 PM, Eric Dumazet wrote:
> On 02/25/2019 03:21 PM, Dmitry Safonov wrote:
>> Well, sure - but it seems confusing that rtnl_unregister() will require
>> synchronize_rcu(), while rtnl_unregister_all() will not.
>
> rtnl_unregister_all() is a different beast, since it removes the whole rtnl_msg_handlers[protocol]
>
> rtnl_unregister() only removes a subset, with different usages.
>
>> And I thought no one would care about another synchronize_rcu() in exit
>> path.
>
> We definitely care about things be done properly.
>
> If synchronize_rcu() is needed there, be it, but kfree_rcu() seems to be fine.
>
> In any case, I believe you need to more carefully explain what is the problem here,
> because I could not really see it.

Ugh, sorry - it seems that I haven't had enough coffee today.

I've read again rtnetlink_rcv_msg(), who is the only user of
rtnl_msg_handlers[] under read_lock, and it calls try_module_get(owner).

Sorry for the noise,
Dmitry