[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtwWlOVl4fyrz24D@nanopsycho>
Date: Sat, 23 Jul 2022 17:41:08 +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
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.
>
>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