Re: [PATCH v2] net: rtnetlink: Fix rtnl_dereference may be return NULL

From: Johannes Berg
Date: Thu Jul 08 2021 - 05:43:41 EST


On Thu, 2021-07-08 at 17:29 +0800, Yajun Deng wrote:
> The value 'link' may be NULL in rtnl_unregister(), this leads to
> kfree_rcu(NULL, xxx), so add this case handling.
>

I don't see how. It would require the caller to unregister something
they never registered. That would be a bug there, but I don't see that
it's very useful to actually be defensive about bugs there.

> And modify the return
> value to 'void' in rtnl_unregister(). there is no case using it.
>
> Fixes: addf9b90de22 (net: rtnetlink: use rcu to free rtnl message handlers)
> Fixes: 51e13685bd93 (rtnetlink: RCU-annotate both dimensions of rtnl_msg_handlers)

It certainly fixes nothing in those patches.

johannes