[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4c/N/H0xrGQwnKP@nanopsycho>
Date: Wed, 30 Nov 2022 12:32:07 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Leon Romanovsky <leon@...nel.org>
Cc: Jakub Kicinski <kuba@...nel.org>, Ido Schimmel <idosch@...sch.org>,
Yang Yingliang <yangyingliang@...wei.com>,
netdev@...r.kernel.org, jiri@...dia.com, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com
Subject: Re: [PATCH net] net: devlink: fix UAF in
devlink_compat_running_version()
Wed, Nov 30, 2022 at 09:54:06AM CET, leon@...nel.org wrote:
>On Tue, Nov 29, 2022 at 06:18:26PM -0800, Jakub Kicinski wrote:
>> On Tue, 29 Nov 2022 09:31:40 +0100 Jiri Pirko wrote:
>> > >Cool. Do you also agree with doing proper refcounting for the devlink
>> > >instance struct and the liveness check after locking the instance?
>> >
>> > Could you elaborate a bit more? I missed that in the thread and can't
>> > find it. Why do we need it?
>>
>> Look at the __devlink_free() and changes
>> to devlink_compat_flash_update() here:
>>
>> https://lore.kernel.org/netdev/20211030231254.2477599-3-kuba@kernel.org/
>>
>> The model I had in mind (a year ago when it all started) was that
>> the driver takes the devlink instance lock around its entire init path,
>> including the registration of the instance. This way the devlink
>> instance is never visible "half initialized". I mean - it's "visible"
>> as in you can see a notification over netlink before init is done but
>> you can't access it until the init in the driver is completed and it
>> releases the instance lock.
>
>In parallel thread, Jiri wanted to avoid this situation of netlink
>notifications for not-visible yet object. He gave as an example
>devlink_port which is advertised without devlink being ready.
To be honest, I'm lost tracking what you point at. I never suggested to
send notification of devlink_port before devlink notification is sent
previously. Perhaps you misread that.
>
>Thanks
Powered by blists - more mailing lists