[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtfgS09cFbQLpCBD@nanopsycho>
Date: Wed, 20 Jul 2022 13:00:27 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Ido Schimmel <idosch@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
petrm@...dia.com, pabeni@...hat.com, edumazet@...gle.com,
mlxsw@...dia.com, saeedm@...dia.com, snelson@...sando.io
Subject: Re: [patch net-next v2 01/12] net: devlink: make sure that
devlink_try_get() works with valid pointer during xarray iteration
Wed, Jul 20, 2022 at 09:45:26AM CEST, idosch@...dia.com wrote:
>On Tue, Jul 19, 2022 at 08:48:36AM +0200, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@...dia.com>
>>
>> Remove dependency on devlink_mutex during devlinks xarray iteration.
>
>Missing motivation... Need to explain that devlink_mutex is held
>throughout every user space command and that while issuing a reload and
>registering / unregistering auxiliary devlink instances we will
>deadlock on this mutex.
Fixed.
>
>>
>> The devlinks xarray consistency is ensured by internally by xarray.
>
>s/by//
Fixed.
>
>> There is a reference taken when working with devlink using
>> devlink_try_get(). But there is no guarantee that devlink pointer
>> picked during xarray iteration is not freed before devlink_try_get()
>> is called.
>>
>> Make sure that devlink_try_get() works with valid pointer.
>> Achieve it by:
>> 1) Splitting devlink_put() so the completion is sent only
>> after grace period. Completion unblocks the devlink_unregister()
>> routine, which is followed-up by devlink_free()
>> 2) Iterate the devlink xarray holding RCU read lock.
>>
>> Signed-off-by: Jiri Pirko <jiri@...dia.com>
Powered by blists - more mailing lists