[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMhUBjm9+nt8j0JFwHEms2Ra1YjhAXquVyHuDYX0_ZZzJyNuZA@mail.gmail.com>
Date: Sat, 5 Mar 2022 22:11:48 +0800
From: Zheyu Ma <zheyuma97@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: nicolas.ferre@...rochip.com, claudiu.beznea@...rochip.com,
netdev@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] net: macb: Use-After-Free when removing the module
On Thu, Mar 3, 2022 at 11:57 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Thu, 3 Mar 2022 20:24:53 +0800 Zheyu Ma wrote:
> > When removing the macb_pci module, the driver will cause a UAF bug.
> >
> > Commit d82d5303c4c5 ("net: macb: fix use after free on rmmod") moves
> > the platform_device_unregister() after clk_unregister(), but this
> > introduces another UAF bug.
>
> The layering is all weird here. macb_probe() should allocate a private
> structure for the _PCI driver_ which it can then attach to
> struct pci_dev *pdev as driver data. Then free it in remove.
> It shouldn't stuff its information into the platform device.
>
> Are you willing to send a fix like that?
Thanks for your useful suggestion, I'm willing to submit a patch.
But I'm a newbie to kernel and I think I need some time to think about
how to make such changes.
Regards,
Zheyu Ma
Powered by blists - more mailing lists