mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Fan Wu <12321260@zju.edu.cn>
Cc: Fan Wu <fanwu01@zju.edu.cn>,
	linux-usb@vger.kernel.org, Pawel Laszczak <pawell@cadence.com>,
	Roger Quadros <rogerq@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Song Li <songl@zju.edu.cn>, Sicong Huang <congei42@163.com>
Subject: Re: [PATCH] usb: cdns3: fix use-after-free in cdns3_gadget_exit()
Date: Tue, 15 Sep 2026 00:32:46 -0700	[thread overview]
Message-ID: <aqj0nuWTHTLpghOJ@hu-petche-lv.qualcomm.com> (raw)
In-Reply-To: <4BDFACF5-50C7-43B5-861C-9467B6E3D819@zju.edu.cn>

On 26-09-10 13:50:46, Fan Wu wrote:
> > On Sep 10, 2026, at 10:28, Peter Chen <peter.chen@kernel.org> wrote:
> > 
> > We may cancel work before going to de-init. How about move them before
> > 
> > pm_runtime_put_autosuspend(cdns->dev);
> > 
> > 
> 
> Hi Peter,
> 
> Thanks for the review.
> 
> I think the work items need to be cancelled only after the gadget has
> been quiesced. Moving the cancellations before
> pm_runtime_put_autosuspend() would run them while the gadget driver is
> still bound and requests may still be queued.
> 
> In particular, an EP0 status request can queue pending_status_wq from
> cdns3_gadget_ep0_queue(), and an endpoint request can queue
> aligned_buf_wq from cdns3_prepare_aligned_request_buf(). Thus either
> work can be re-queued after an early cancellation and before
> usb_del_gadget() unbinds the gadget driver.
> 
> usb_del_gadget() performs the gadget unbind and synchronizes the gadget
> IRQ; devm_free_irq() then removes the driver's IRQ handler. Keeping the
> cancellations after these teardown steps ensures that both works are
> drained before cdns3_free_all_eps() and the aligned buffers are freed.
> 
> Could we keep the current placement?

Sure, your comment is reasonable.

-- 

Thanks,
Peter Chen

  reply	other threads:[~2026-09-15  7:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  9:56 Fan Wu
2026-09-10  2:28 ` Peter Chen
2026-09-10  5:50   ` Fan Wu
2026-09-15  7:32     ` Peter Chen [this message]
2026-09-15  7:33 ` Peter Chen

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=aqj0nuWTHTLpghOJ@hu-petche-lv.qualcomm.com \
    --to=peter.chen@kernel.org \
    --cc=12321260@zju.edu.cn \
    --cc=congei42@163.com \
    --cc=fanwu01@zju.edu.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=rogerq@kernel.org \
    --cc=songl@zju.edu.cn \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®