From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Cheng Lingfei <chenglingfei@foxmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Felipe Balbi <balbi@kernel.org>, Peter Chen <peter.chen@nxp.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+06ec7624018233e17113@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] usb: gadget: goku_udc: fix kobject warning on probe failure
Date: Wed, 26 Aug 2026 10:33:26 +0200 [thread overview]
Message-ID: <2026082606-stilt-swan-28cb@gregkh> (raw)
In-Reply-To: <tencent_C241874A5406FB9AE72DCEEB8717B208EC05@qq.com>
On Wed, Aug 26, 2026 at 04:26:47PM +0800, Cheng Lingfei wrote:
> goku_probe() calls goku_remove() when hardware initialization fails, but
> the gadget device is initialized only near the end of probe. As a result,
> goku_remove() calls usb_del_gadget_udc(), which drops a reference to an
> uninitialized gadget device and triggers a kobject warning.
>
> Initialize the gadget device immediately after allocating the controller,
> but add it only after all hardware resources have been acquired. Track the
> gadget registration state so goku_remove() can safely clean up both partial
> probe state and a fully initialized device.
>
> Use the split gadget removal API and drop the final gadget reference only
> after all hardware resources have been released. Obtain the controller from
> the embedded gadget device in the release callback because driver data is
> set on the PCI device rather than the gadget device.
>
> The legacy diagnostic proc entry uses a single global name. This causes a
> collision when more than one controller is probed. Replace it with a
> per-device debugfs entry.
>
> Fixes: 3301c215a2bb ("USB: UDC: Expand device model API interface")
> Reported-by: syzbot+06ec7624018233e17113@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=06ec7624018233e17113
> Tested-by: syzbot+06ec7624018233e17113@syzkaller.appspotmail.com
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Link: https://lore.kernel.org/2026082616-glue-atlas-0cfd@gregkh
> Assisted-by: Codex:gpt-5.6
> Signed-off-by: Cheng Lingfei <chenglingfei@foxmail.com>
> ---
> Changes in v2:
> - Replace legacy procfs with per-device debugfs entries.
debugfs changes should be a separate change, please make this a patch
series.
thanks,
greg k-h
prev parent reply other threads:[~2026-08-26 8:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 8:26 [PATCH v2] usb: gadget: goku_udc: fix kobject warning on probe failure Cheng Lingfei
2026-08-26 8:33 ` 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=2026082606-stilt-swan-28cb@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=balbi@kernel.org \
--cc=chenglingfei@foxmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@nxp.com \
--cc=stern@rowland.harvard.edu \
--cc=syzbot+06ec7624018233e17113@syzkaller.appspotmail.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).