[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5mAbfpeHEuQp0BE@unreal>
Date: Wed, 14 Dec 2022 09:51:09 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Nir Levy <bhr166@...il.com>, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com,
linux-atm-general@...ts.sourceforge.net, netdev@...r.kernel.org
Subject: Re: [PATCH net v2] net: atm: Fix use-after-free bug in
atm_dev_register()
On Tue, Dec 13, 2022 at 07:12:33PM -0800, Jakub Kicinski wrote:
> On Mon, 12 Dec 2022 09:12:30 +0200 Leon Romanovsky wrote:
> > > v2: Call put_device in atm_register_sysfs instead of atm_dev_register.
> >
> > Reviewed-by: Leon Romanovsky <leonro@...dia.com>
>
> On one of the previous versions you commented that
> atm_unregister_sysfs() also needs to move to unregister() rather
> than del():
>
> https://lore.kernel.org/all/Y48CwyATYAAcPgqT@unreal/
>
> Is that not the case?
Yes, it should, but it is much larger change than this fix and someone
needs to do it as a separate patch.
You can't simply replace device_del() in atm_unregister_sysfs() because
how atm_dev_put() is implemented. The latter blindly calls to put_device(&dev->class_dev)
and you can't remove it without close look on all atm_dev_put() callers.
>
> Also atm_dev_register() still frees the dev on atm_register_sysfs()
> failure, is that okay?
Yes, the kernel panic points that class_dev (not dev) had use-after-free.
Thanks
Powered by blists - more mailing lists