[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4caLsLEQFMgz7HV@unreal>
Date: Wed, 30 Nov 2022 10:54:06 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Jiri Pirko <jiri@...nulli.us>, 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()
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.
Thanks
Powered by blists - more mailing lists