From: Cheng Lingfei <chenglingfei@foxmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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] usb: gadget: goku_udc: fix kobject warning on probe failure
Date: Wed, 26 Aug 2026 15:00:37 +0800 [thread overview]
Message-ID: <tencent_73FAA277D81B3C4771D63F33904760133A08@qq.com> (raw)
In-Reply-To: <2026082616-glue-atlas-0cfd@gregkh>
On 8/26/2026 2:11 PM, Greg Kroah-Hartman wrote:
> On Wed, Aug 26, 2026 at 11:35:58AM +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 and proc entry 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.
>>
>> Also obtain the controller from the embedded gadget device in the release
>> callback. Driver data is set on the PCI device rather than the gadget
>> device, so using dev_get_drvdata() there fails to free the controller.
>>
>> Use a per-device name for the debug proc entry so that multiple
>> controllers can be registered without colliding on /proc/driver/udc.
>>
>> 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
>>
>> Signed-off-by: Cheng Lingfei <chenglingfei@foxmail.com>
>
> No Assisted-by: line?
>
> And do you see this happening in a real device and not just a fake one?
>
> And why is this driver using proc at all, shouldn't that be in debugfs
> instead?
>
> thanks,
>
> greg k-h
Thanks for the review.
I do not have TC86C001 hardware. The issue was reproduced only by
syzbot, whose reproducer binds goku_udc to unrelated QEMU PCI devices
through the PCI new_id interface.
The probe cleanup path itself can also be reached on real hardware if
one of the probe steps fails, but I cannot claim that the issue has
been reproduced on real hardware.
The proc entry is legacy diagnostic code from this old driver, so I
agree that debugfs is the appropriate interface. I will rework the
patch accordingly and send a v2.
I will also add the missing Assisted-by line.
next prev parent reply other threads:[~2026-08-26 7:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 3:35 Cheng Lingfei
2026-08-26 6:11 ` Greg Kroah-Hartman
2026-08-26 7:00 ` Cheng Lingfei [this message]
2026-08-26 7:09 ` Greg Kroah-Hartman
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=tencent_73FAA277D81B3C4771D63F33904760133A08@qq.com \
--to=chenglingfei@foxmail.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--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
all inboxes | Powered by JetHome®