From: Greg KH <gregkh@linuxfoundation.org>
To: Zheng Wang <zyytlz.wz@163.com>
Cc: skhan@linuxfoundation.org, p.zabel@pengutronix.de,
biju.das.jz@bp.renesas.com, phil.edworthy@renesas.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
hackerzheng666@gmail.com, 1395428693sheep@gmail.com,
alex000young@gmail.com, yoshihiro.shimoda.uh@renesas.com
Subject: Re: [PATCH v7] usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition
Date: Thu, 16 Mar 2023 20:07:18 +0100 [thread overview]
Message-ID: <ZBNo5gr1ILs5mR5z@kroah.com> (raw)
In-Reply-To: <20230316180850.1600867-1-zyytlz.wz@163.com>
On Fri, Mar 17, 2023 at 02:08:50AM +0800, Zheng Wang wrote:
> In renesas_usb3_probe, role_work is bound with renesas_usb3_role_work.
> renesas_usb3_start will be called to start the work.
>
> If we remove the driver which will call usbhs_remove, there may be
> an unfinished work. The possible sequence is as follows:
>
> Fix it by canceling the work before cleanup in the renesas_usb3_remove.
>
> Note that removing a driver is a root-only operation, and should never
> happen.
>
> CPU0 CPU1
>
> | renesas_usb3_role_work
> renesas_usb3_remove |
> usb_role_switch_unregister|
> device_unregister |
> kfree(sw) |
> free usb3->role_sw |
> | usb_role_switch_set_role
> | //use usb3->role_sw
This still isn't working :(
next prev parent reply other threads:[~2023-03-16 19:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 18:08 [PATCH v7] usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition Zheng Wang
2023-03-16 19:07 ` Greg KH [this message]
2023-03-17 3:59 ` Zheng Hacker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZBNo5gr1ILs5mR5z@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=1395428693sheep@gmail.com \
--cc=alex000young@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=hackerzheng666@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=phil.edworthy@renesas.com \
--cc=skhan@linuxfoundation.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
--cc=zyytlz.wz@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).