Re: [PATCH] usb: gadget: Assign a unique name for each configfs

From: Frank Li
Date: Thu Dec 08 2022 - 11:54:09 EST


From: Frank Li <Frank.li@xxxxxxx>

On Wed, Sep 07, 2022 at 01:57:07PM +0200, Greg KH wrote:
> On Wed, Sep 07, 2022 at 07:22:10PM +0800, Rondreis wrote:
> > When fuzzing the kernel, I couldn't use configfs to attach more than one
> > gadget. When attaching the second gadget with a different UDC it always
> > failed and the kernel message said:
> >
> > Error: Driver 'configfs-gadget' is already registered, aborting...
> > UDC core: g1: driver registration failed: -16
> >
> > The problem is that when creating multiple gadgets with configfs and
> > binding them to different UDCs, the UDC drivers have the same name
> > "configfs-gadget". Because of the addition of the "gadget" bus,
> > naming conflicts will occur when more than one UDC drivers
> > registered to the bus.
> >
> > It's not an isolated case, this patch refers to the commit f2d8c2606825
> > ("usb: gadget: Fix non-unique driver names in raw-gadget driver").
> > Each configfs-gadget driver will be assigned a unique name
> > "configfs-gadget.N", with a different value of N for each driver instance.
>
> Please wrap your changelog text at 72 columns like the documentation
> asks for.
>
> > Reported-and-tested-by: Rondreis <linhaoguo86@xxxxxxxxx>
> > Signed-off-by: Rondreis <linhaoguo86@xxxxxxxxx>
>

I met the same issue, do you plan continue this patch after fix greg's comments.
If you have not time, I can continue it.

Frank Li