[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yt5RjrqG1WZelSOH@nanopsycho>
Date: Mon, 25 Jul 2022 10:17:18 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, idosch@...dia.com,
petrm@...dia.com, pabeni@...hat.com, edumazet@...gle.com,
mlxsw@...dia.com, saeedm@...dia.com, snelson@...sando.io
Subject: Re: [patch net-next v3 01/11] net: devlink: make sure that
devlink_try_get() works with valid pointer during xarray iteration
Sat, Jul 23, 2022 at 05:41:08PM CEST, jiri@...nulli.us wrote:
>Fri, Jul 22, 2022 at 08:23:48PM CEST, kuba@...nel.org wrote:
>>On Fri, 22 Jul 2022 17:50:17 +0200 Jiri Pirko wrote:
>>> >Plus we need to be more careful about the unregistering order, I
>>> >believe the correct ordering is:
>>> >
>>> > clear_unmark()
>>> > put()
>>> > wait()
>>> > notify()
>>> >
>>> >but I believe we'll run afoul of Leon's notification suppression.
>>> >So I guess notify() has to go before clear_unmark(), but we should
>>> >unmark before we wait otherwise we could live lock (once the mutex
>>> >is really gone, I mean).
>>>
>>> Kuba, could you elaborate a bit more about the live lock problem here?
>>
>>Once the devlink_mutex lock is gone - (unprivileged) user space dumping
>>devlink objects could prevent any de-registration from happening
>>because it can keep the reference of the instance up. So we should mark
>>the instance as not REGISTERED first, then go to wait.
>
>Yeah, that is what I thought. I resolved it as you wrote. I removed the
>WARN_ON from devlink_notify(). It is really not good for anything
>anyway.
The check for "registered" is in more notifications. I will handle this
in the next patchset, you are right, it is not needed to handle here.
Sending v4.
Thanks!
>
>
>>
>>Pretty theoretical, I guess, but I wanted to mention it in case you can
>>figure out a solution along the way :S I don't think it's a blocker
>>right now since we still have the mutex.
>
>Got it.
Powered by blists - more mailing lists