Re: [PATCH v2] net: rtnetlink: Fix rtnl_dereference may be return NULL
From: Vladimir Oltean
Date: Thu Jul 08 2021 - 07:11:25 EST
On Thu, Jul 08, 2021 at 11:43:20AM +0200, Johannes Berg wrote:
> 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.
Besides, isn't kfree_rcu(NULL) safe anyway?