Re: [RFC net-next 00/10] devlink: remove the wait-for-references on unregister

Jacob Keller
2022-12-19T22:16:11Z

On 12/19/2022 2:10 PM, Jakub Kicinski wrote:
> On Mon, 19 Dec 2022 09:38:09 -0800 Jacob Keller wrote:
>> On 12/16/2022 5:19 PM, Jakub Kicinski wrote:
>>> This set is on top of the previous RFC.
>>>
>>> Move the registration and unregistration of the devlink instances
>>> under their instance locks. Don't perform the netdev-style wait
>>> for all references when unregistering the instance.
>>
>> Could you explain the reasoning/benefits here? I'm sure some of this is
>> explained in each commit message as well but it would help to understand
>> the overall series.
>
> Fair point, I'll add this:
>
> Yang Yingliang reported [1] a use-after-free in devlink because netdev
> paths are able to acquire a reference on the devlink instances before
> they are registered.
>
> [1]
> https://lore.kernel.org/all/20221122121048.776643-1-yangyingliang@huawei.com/

Great. I also think its better to allow some of the sub objects to be
setup either before or after registering, as some things might be
dynamic. This series lets us get there safely which is good.