public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Zheng Wang <zyytlz.wz@163.com>
Cc: 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 v3] usb: gadget: udc: renesas_usb3: Fix use after free bug in  renesas_usb3_remove due to race condition
Date: Thu, 16 Mar 2023 11:55:11 +0100	[thread overview]
Message-ID: <ZBL1jyAQJ2YPsKUe@kroah.com> (raw)
In-Reply-To: <20230313165128.3763626-1-zyytlz.wz@163.com>

On Tue, Mar 14, 2023 at 12:51:28AM +0800, Zheng Wang wrote:
> In renesas_usb3_probe, &usb3->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
> 
> 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
> 
> Fixes: 39facfa01c9f ("usb: gadget: udc: renesas_usb3: Add register of usb role switch")
> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
> ---
> v3:
> - modify the commit message to make it clearer suggested by Yoshihiro Shimoda

I see 2 v3 patches in the mailing list, which is obviously not correct.

Please resubmit a v4 properly.

thanks,

greg k-h

  parent reply	other threads:[~2023-03-16 10:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 16:51 [PATCH v3] usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition Zheng Wang
2023-03-14  0:16 ` Yoshihiro Shimoda
2023-03-14  2:20   ` Zheng Hacker
2023-03-16 10:55 ` Greg KH [this message]
2023-03-16 13:28   ` Zheng Hacker
  -- strict thread matches above, loose matches on Subject: below --
2023-03-13  9:48 Zheng Wang
2023-03-13 12:56 ` Yoshihiro Shimoda
2023-03-13 16:51   ` 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=ZBL1jyAQJ2YPsKUe@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=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