Re: [syzbot] WARNING in driver_unregister

From: Greg KH
Date: Sat May 28 2022 - 08:08:57 EST


On Fri, May 27, 2022 at 05:36:51PM -0400, Alan Stern wrote:
> On Fri, May 27, 2022 at 12:29:08PM -0700, syzbot wrote:
> > Hello,
> >
> > syzbot has tested the proposed patch but the reproducer is still triggering an issue:
> > WARNING in sysfs_create_file_ns
> >
> > really_probe: driver_sysfs_add(gadget.0) failed
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 2361 at fs/sysfs/file.c:351 sysfs_create_file_ns+0x131/0x1c0 fs/sysfs/file.c:351
> > Modules linked in:
> > CPU: 0 PID: 2361 Comm: syz-executor.0 Not tainted 5.18.0-rc5-syzkaller-00157-g97fa5887cf28-dirty #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> > RIP: 0010:sysfs_create_file_ns+0x131/0x1c0 fs/sysfs/file.c:351
> > Code: e9 03 80 3c 01 00 75 7f 8b 4c 24 38 4d 89 e9 48 89 ee 48 8b 7b 30 44 8b 44 24 48 e8 e9 fa ff ff 41 89 c5 eb 0d e8 cf 7c 9d ff <0f> 0b 41 bd ea ff ff ff e8 c2 7c 9d ff 48 b8 00 00 00 00 00 fc ff
> > RSP: 0018:ffffc900028ffca0 EFLAGS: 00010293
>
> Here's some extra detail, taken from the console log:
>
> [ 98.336685][ T2361] really_probe: driver_sysfs_add(gadget.0) failed
> [ 98.336836][ T2360] sysfs: cannot create duplicate filename '/bus/gadget/drivers/dummy_udc'
> [ 98.343498][ T2361] ------------[ cut here ]------------
> [ 98.352154][ T2360] CPU: 1 PID: 2360 Comm: syz-executor.0 Not tainted 5.18.0-rc5-syzkaller-00157-g97fa5887cf28-dirty #0
> [ 98.357802][ T2361] WARNING: CPU: 0 PID: 2361 at fs/sysfs/file.c:351 sysfs_create_file_ns+0x131/0x1c0
>
> Simultaneous splats from two different threads trying to add drivers with
> the same name suggests there might be a concurrency bug in the sysfs
> filesystem. This sort of thing should be an error but it shouldn't bring
> the kernel to its knees.

It's not bringing anything down, it's just giving you a big fat warning
that the developer did something wrong and it should be fixed. The
kernel should keep working just fine after this.

> Greg, do you know anyone who could take a look at this? I don't know much
> about sysfs.

It's not a sysfs thing, it's a "we should not register the same driver
name multiple times" thing, so that subsystem needs to be fixed to make
this always a unique name.

thanks,

greg k-h