All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hongyan Xu <getshell@seu.edu.cn>
Cc: Vladimir Zapolskiy <vz@mleia.com>,
	Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Subject: Re: [PATCH v2] usb: gadget: lpc32xx_udc: drain pullup work before teardown
Date: Fri, 20 Nov 2026 15:23:03 +0100	[thread overview]
Message-ID: <2026112007-lumber-pounce-3ec2@gregkh> (raw)
In-Reply-To: <179474326988.103840.10326852247134349070@seu.edu.cn>

On Sun, Nov 15, 2026 at 07:47:49PM +0800, Hongyan Xu wrote:
> The pullup worker accesses the transceiver I2C client and UDC
> state. IRQs can leave it pending when remove or a late probe
> failure releases those resources. Cancelling the final pullup
> work would also discard the requested disconnect.
> 
> After the gadget core has stopped its callbacks, explicitly free
> and synchronize the registered UDC IRQs. Request pullup-off and
> flush its worker while the transceiver client is still retained.
> The worker needs no UDC IRQ to finish its I2C transaction.
> 
> Track successful IRQ registrations during probe so late failure
> also stops all acquired producers and drains pullup work before
> destroying DMA resources and dropping the I2C client.
> 
> Found by the author's in-house static analysis tool.
> 
> Fixes: 24a28e428351 ("USB: gadget driver for LPC32xx")
> Cc: stable@vger.kernel.org
> Suggested-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
> Link: https://lore.kernel.org/all/20260928134158.117-1-getshell@seu.edu.cn/
> Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
> Signed-off-by: Zehao Gao <gaozehao@iie.ac.cn>
> ---
> 
> Discovery: found by the author's in-house static analysis tool.
> 
>  drivers/usb/gadget/udc/lpc32xx_udc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
> index 94355d3..d627a2a 100644
> --- a/drivers/usb/gadget/udc/lpc32xx_udc.c
> +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
> @@ -2978,10 +2978,17 @@ static struct lpc32xx_usbd_cfg lpc32xx_usbddata = {
>  
>  static u64 lpc32xx_usbd_dmamask = ~(u32) 0x7F;
>  
> +static void lpc32xx_udc_free_irqs(struct lpc32xx_udc *udc, unsigned int count)
> +{
> +	while (count--)
> +		devm_free_irq(udc->dev, udc->udp_irq[count], udc);
> +}

This is "funny", please unwind things in a better way.  Also, have you
ever hit this in an actual device?  If not, don't make changes like
this.

thanks,

greg k-h

      parent reply	other threads:[~2026-11-20 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 11:47 [PATCH v2] usb: gadget: lpc32xx_udc: drain pullup work before teardown Hongyan Xu
2026-11-15 11:54 ` sashiko-bot
2026-11-20 14:23 ` Greg Kroah-Hartman [this message]

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=2026112007-lumber-pounce-3ec2@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=getshell@seu.edu.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=piotr.wojtaszczyk@timesys.com \
    --cc=qwe.aldo@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vz@mleia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.