Skip to contentSkip to conversation

usb: usbtest: fix NULL pointer dereference in usbtest_probe

PATCH Superseded syzbot 5 participants 12 messages Jul 29 – Aug 6

Subsystems (2)
lore
Share & tools
lore

syzbot

author syzbot
#0 lore raw

From: Aleksandr Nogikh <[email protected]>

The usbtest driver relies on the driver_info field of the usb_device_id structure to hold a pointer to a struct usbtest_info, which contains necessary configuration for the device. When a new device ID is dynamically added via the sysfs new_id interface without specifying a reference device, the driver_info field defaults to 0. When the USB core binds the device using this dynamic ID, usbtest_probe() unconditionally casts the 0 to a pointer, resulting in a NULL pointer dereference when attempting to access the autoconf bitfield (at offset 0xa) of the struct usbtest_info.

This leads to the following crash:

Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:usbtest_probe+0x522/0xcc0 drivers/usb/misc/usbtest.c:2822
Call Trace:
 <TASK>
 usb_probe_interface+0x653/0xc60 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x254/0xae0 drivers/base/dd.c:706
 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
 __device_attach_driver+0x270/0x410 drivers/base/dd.c:1026
 bus_for_each_drv+0x258/0x2f0 drivers/base/bus.c:500
 __device_attach+0x2c4/0x450 drivers/base/dd.c:1098
 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1153
 bus_probe_device+0x12a/0x220 drivers/base/bus.c:620
 device_add+0x7d7/0xb80 drivers/base/core.c:3772
 usb_set_configuration+0x1ad8/0x2180 drivers/usb/core/message.c:2268
 usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:250
 usb_probe_device+0x1c3/0x3b0 drivers/usb/core/driver.c:291

To fix this, validate that id->driver_info is not NULL before proceeding with the probe. If it is NULL, gracefully return -ENODEV. The check is placed before any memory allocation to avoid unnecessary work and simplify error handling.

Fixes 733260ff9c45 ("[PATCH] USB: add dynamic id functionality to USB core")
Assisted-by Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot
Reported-by [email protected]

---

drivers/usb/misc/usbtest.c +4 -1
index 98071b25a..6410b3e26 100644
@@ -2786,10 +2786,13 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	}
 #endif
 
+	info = (struct usbtest_info *) id->driver_info;
+	if (!info)
+		return -ENODEV;
+
 	dev = kzalloc_obj(*dev);
 	if (!dev)
 		return -ENOMEM;
-	info = (struct usbtest_info *) id->driver_info;
 	dev->info = info;
 	mutex_init(&dev->lock);
 

base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff

Signature · 4 lines
See https://goo.gle/syzbot-ai-patches for information about AI-generated patches.
You can comment on the patch as usual, syzbot will try to address
the comments and send a new version of the patch if necessary.
syzbot engineers can be reached at [email protected].
#1 lore raw
Quoted 52 lines · syzbot

From: Aleksandr Nogikh <[email protected]>

The usbtest driver relies on the driver_info field of the usb_device_id structure to hold a pointer to a struct usbtest_info, which contains necessary configuration for the device. When a new device ID is dynamically added via the sysfs new_id interface without specifying a reference device, the driver_info field defaults to 0. When the USB core binds the device using this dynamic ID, usbtest_probe() unconditionally casts the 0 to a pointer, resulting in a NULL pointer dereference when attempting to access the autoconf bitfield (at offset 0xa) of the struct usbtest_info.

This leads to the following crash:

Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:usbtest_probe+0x522/0xcc0 drivers/usb/misc/usbtest.c:2822
Call Trace:
 <TASK>
 usb_probe_interface+0x653/0xc60 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x254/0xae0 drivers/base/dd.c:706
 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
 __device_attach_driver+0x270/0x410 drivers/base/dd.c:1026
 bus_for_each_drv+0x258/0x2f0 drivers/base/bus.c:500
 __device_attach+0x2c4/0x450 drivers/base/dd.c:1098
 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1153
 bus_probe_device+0x12a/0x220 drivers/base/bus.c:620
 device_add+0x7d7/0xb80 drivers/base/core.c:3772
 usb_set_configuration+0x1ad8/0x2180 drivers/usb/core/message.c:2268
 usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:250
 usb_probe_device+0x1c3/0x3b0 drivers/usb/core/driver.c:291

To fix this, validate that id->driver_info is not NULL before proceeding with the probe. If it is NULL, gracefully return -ENODEV. The check is placed before any memory allocation to avoid unnecessary work and simplify error handling.

Fixes 733260ff9c45 ("[PATCH] USB: add dynamic id functionality to USB core")
Assisted-by Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot
Reported-by [email protected]

---

drivers/usb/misc/usbtest.c +0 -0
index 98071b25a..6410b3e26 100644

drivers/usb/misc/usbtest.c usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) · line 2789

Quoted 4 lines
drivers/usb/misc/usbtest.c +1 -0
@@ -2786,10 +2786,13 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	}
 #endif
 
+	info = (struct usbtest_info *) id->driver_info;

Extra space there, right? Didn't checkpatch catch that?

And this really isn't the proper solution, just don't allow dynamic binding for this driver. That should resolve it, right?

thanks,

greg k-h

#2 lore raw
Quoted 35 lines · Greg Kroah-Hartman
Quoted 34 lines · syzbot

From: Aleksandr Nogikh <[email protected]>

The usbtest driver relies on the driver_info field of the usb_device_id structure to hold a pointer to a struct usbtest_info, which contains necessary configuration for the device. When a new device ID is dynamically added via the sysfs new_id interface without specifying a reference device, the driver_info field defaults to 0. When the USB core binds the device using this dynamic ID, usbtest_probe() unconditionally casts the 0 to a pointer, resulting in a NULL pointer dereference when attempting to access the autoconf bitfield (at offset 0xa) of the struct usbtest_info.

This leads to the following crash:

Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:usbtest_probe+0x522/0xcc0 drivers/usb/misc/usbtest.c:2822
Call Trace:
 <TASK>
 usb_probe_interface+0x653/0xc60 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x254/0xae0 drivers/base/dd.c:706
 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
 __device_attach_driver+0x270/0x410 drivers/base/dd.c:1026
 bus_for_each_drv+0x258/0x2f0 drivers/base/bus.c:500
 __device_attach+0x2c4/0x450 drivers/base/dd.c:1098
 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1153
 bus_probe_device+0x12a/0x220 drivers/base/bus.c:620
 device_add+0x7d7/0xb80 drivers/base/core.c:3772
 usb_set_configuration+0x1ad8/0x2180 drivers/usb/core/message.c:2268
 usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:250
 usb_probe_device+0x1c3/0x3b0 drivers/usb/core/driver.c:291
Quoted 6 lines
Quoted 6 lines

To fix this, validate that id->driver_info is not NULL before proceeding with the probe. If it is NULL, gracefully return -ENODEV. The check is placed before any memory allocation to avoid unnecessary work and simplify error handling.

Fixes 733260ff9c45 ("[PATCH] USB: add dynamic id functionality to USB core")

Not really, but I can see why the LLM thinks this. It's "just how this driver works" instead, right?

Quoted 15 lines
Quoted 15 lines

---

drivers/usb/misc/usbtest.c +0 -0
index 98071b25a..6410b3e26 100644
@@ -2786,10 +2786,13 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	}
 #endif
 
Quoted 6 lines

drivers/usb/misc/usbtest.c usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) · line 2789

Quoted 1 line
drivers/usb/misc/usbtest.c +1 -0
+	info = (struct usbtest_info *) id->driver_info;

Extra space there, right? Didn't checkpatch catch that?

And this really isn't the proper solution, just don't allow dynamic binding for this driver. That should resolve it, right?

If you don't want to do that, you need a BIG comment here as to what you are trying to prevent, as a NULL check just looks like any other normal check, while you are trying to prevent a specific use case from being possible, and it WILL have user-visable affect.

thanks,

greg k-h

#3 lore raw

Hi Greg,

Thanks for the review!

Quoted 42 lines · Greg Kroah-Hartman
Quoted 40 lines · Greg Kroah-Hartman
Quoted 39 lines · syzbot

From: Aleksandr Nogikh <[email protected]>

The usbtest driver relies on the driver_info field of the usb_device_id structure to hold a pointer to a struct usbtest_info, which contains necessary configuration for the device. When a new device ID is dynamically added via the sysfs new_id interface without specifying a reference device, the driver_info field defaults to 0. When the USB core binds the device using this dynamic ID, usbtest_probe() unconditionally casts the 0 to a pointer, resulting in a NULL pointer dereference when attempting to access the autoconf bitfield (at offset 0xa) of the struct usbtest_info.

This leads to the following crash:

Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:usbtest_probe+0x522/0xcc0 drivers/usb/misc/usbtest.c:2822
Call Trace:
 <TASK>
 usb_probe_interface+0x653/0xc60 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x254/0xae0 drivers/base/dd.c:706
 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
 __device_attach_driver+0x270/0x410 drivers/base/dd.c:1026
 bus_for_each_drv+0x258/0x2f0 drivers/base/bus.c:500
 __device_attach+0x2c4/0x450 drivers/base/dd.c:1098
 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1153
 bus_probe_device+0x12a/0x220 drivers/base/bus.c:620
 device_add+0x7d7/0xb80 drivers/base/core.c:3772
 usb_set_configuration+0x1ad8/0x2180 drivers/usb/core/message.c:2268
 usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:250
 usb_probe_device+0x1c3/0x3b0 drivers/usb/core/driver.c:291

To fix this, validate that id->driver_info is not NULL before proceeding with the probe. If it is NULL, gracefully return -ENODEV. The check is placed before any memory allocation to avoid unnecessary work and simplify error handling.

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Fixes 733260ff9c45 ("[PATCH] USB: add dynamic id functionality to USB core")

Not really, but I can see why the LLM thinks this. It's "just how this driver works" instead, right?

Quoted 18 lines
Quoted 12 lines

---

drivers/usb/misc/usbtest.c +0 -0
index 98071b25a..6410b3e26 100644

drivers/usb/misc/usbtest.c usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) · line 2789

Quoted 4 lines
drivers/usb/misc/usbtest.c +1 -0
@@ -2786,10 +2786,13 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
    }
 #endif
 
+   info = (struct usbtest_info *) id->driver_info;

Extra space there, right? Didn't checkpatch catch that?

The checkpatch was happy with the diff:
total: 0 errors, 0 warnings, 14 lines checked

You mean the whitespace after *)?
I've just looked at the other code in drivers/usb/misc/usbtest.c, and it's inconsistent: in some cases there's a whiltespace, in some isn't.

Quoted 3 lines
Quoted 3 lines

And this really isn't the proper solution, just don't allow dynamic binding for this driver. That should resolve it, right?

I'll double-check that and send a v2, thanks for the suggestion.

Quoted 9 lines

If you don't want to do that, you need a BIG comment here as to what you are trying to prevent, as a NULL check just looks like any other normal check, while you are trying to prevent a specific use case from being possible, and it WILL have user-visable affect.

thanks,

greg k-h

Signature · 1 line
Aleksandr
#4 lore raw

PATCH v2 1/1 usb: usbtest: disable dynamic ID support

In reply to Greg Kroah-Hartman

The usbtest driver relies on the driver_info field of struct usb_device_id to point to a valid struct usbtest_info descriptor. This structure contains essential test configurations, such as endpoint addresses and test modes, which are required during probe.

When a user dynamically adds a new device ID via the sysfs new_id interface without specifying a reference device, the USB core initializes driver_info to 0 (NULL). When a matching device is subsequently probed, usbtest_probe() unconditionally casts driver_info to a struct usbtest_info pointer and dereferences it, leading to a NULL pointer dereference crash:

  Oops: general protection fault, probably for non-canonical address
  0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
  RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822

Because usbtest strictly requires pre-defined usbtest_info descriptors to function, dynamic ID binding via sysfs is fundamentally unsupported for this driver.

Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs the USB core to skip creating the new_id and remove_id sysfs interfaces for usbtest, preventing invalid dynamic ID entries from being created.

---
Changes in v2:
- Disable dynamic IDs via .no_dynamic_id = 1 instead of adding a runtime NULL check in probe().
- Link to v1: https://lore.kernel.org/r/[email protected]

 drivers/usb/misc/usbtest.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/misc/usbtest.c +1 -0
index 98071b25ac076..8759df49be287 100644
@@ -3054,6 +3054,7 @@ static struct usb_driver usbtest_driver = {
 	.disconnect =	usbtest_disconnect,
 	.suspend =	usbtest_suspend,
 	.resume =	usbtest_resume,
+	.no_dynamic_id = 1,
 };
 
 /*-------------------------------------------------------------------------*/
Signature · 3 lines
base-commit: 48a5a7ab8d6ab7090564339e039c421f315de912
-- 
2.55.0.654.g21b8a5bc05-goog
#5 lore raw

Re: [PATCH v2] usb: usbtest: disable dynamic ID support

Quoted 20 lines · Aleksandr Nogikh

The usbtest driver relies on the driver_info field of struct usb_device_id to point to a valid struct usbtest_info descriptor. This structure contains essential test configurations, such as endpoint addresses and test modes, which are required during probe.

When a user dynamically adds a new device ID via the sysfs new_id interface without specifying a reference device, the USB core initializes driver_info to 0 (NULL). When a matching device is subsequently probed, usbtest_probe() unconditionally casts driver_info to a struct usbtest_info pointer and dereferences it, leading to a NULL pointer dereference crash:

  Oops: general protection fault, probably for non-canonical address
  0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
  RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822

Because usbtest strictly requires pre-defined usbtest_info descriptors to function, dynamic ID binding via sysfs is fundamentally unsupported for this driver.

Quoted 7 lines

Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs the USB core to skip creating the new_id and remove_id sysfs interfaces for usbtest, preventing invalid dynamic ID entries from being created.

Shouldn't this also get a cc: stable?

thanks,

greg k-h

#6 lore raw

Re: [PATCH v2] usb: usbtest: disable dynamic ID support

Quoted 26 lines · Greg Kroah-Hartman
Quoted 24 lines · Aleksandr Nogikh

The usbtest driver relies on the driver_info field of struct usb_device_id to point to a valid struct usbtest_info descriptor. This structure contains essential test configurations, such as endpoint addresses and test modes, which are required during probe.

When a user dynamically adds a new device ID via the sysfs new_id interface without specifying a reference device, the USB core initializes driver_info to 0 (NULL). When a matching device is subsequently probed, usbtest_probe() unconditionally casts driver_info to a struct usbtest_info pointer and dereferences it, leading to a NULL pointer dereference crash:

  Oops: general protection fault, probably for non-canonical address
  0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
  RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822

Because usbtest strictly requires pre-defined usbtest_info descriptors to function, dynamic ID binding via sysfs is fundamentally unsupported for this driver.

Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs the USB core to skip creating the new_id and remove_id sysfs interfaces for usbtest, preventing invalid dynamic ID entries from being created.

Quoted 5 lines
Quoted 3 lines

Shouldn't this also get a cc: stable?

Is there (in general) value in cc: stable without a Fixes: tag?

Quoted 4 lines

thanks,

greg k-h

#7 lore raw

Re: [PATCH v2] usb: usbtest: disable dynamic ID support

Quoted 28 lines · Aleksandr Nogikh
Quoted 26 lines · Greg Kroah-Hartman
Quoted 24 lines · Aleksandr Nogikh

The usbtest driver relies on the driver_info field of struct usb_device_id to point to a valid struct usbtest_info descriptor. This structure contains essential test configurations, such as endpoint addresses and test modes, which are required during probe.

When a user dynamically adds a new device ID via the sysfs new_id interface without specifying a reference device, the USB core initializes driver_info to 0 (NULL). When a matching device is subsequently probed, usbtest_probe() unconditionally casts driver_info to a struct usbtest_info pointer and dereferences it, leading to a NULL pointer dereference crash:

  Oops: general protection fault, probably for non-canonical address
  0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
  RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822

Because usbtest strictly requires pre-defined usbtest_info descriptors to function, dynamic ID binding via sysfs is fundamentally unsupported for this driver.

Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs the USB core to skip creating the new_id and remove_id sysfs interfaces for usbtest, preventing invalid dynamic ID entries from being created.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Shouldn't this also get a cc: stable?

Is there (in general) value in cc: stable without a Fixes: tag?

Very much so. Don't you want this in stable trees so that your syzbot runs on the older kernels don't fail horribly? If not, then hey, waiting for newer releases is fine with me, but I got the impression this was a good thing to fix :)

thanks,

greg k-h

#8 lore raw

Re: [PATCH v2] usb: usbtest: disable dynamic ID support

Quoted 34 lines · Greg Kroah-Hartman
Quoted 32 lines · Aleksandr Nogikh
Quoted 30 lines · Greg Kroah-Hartman
Quoted 27 lines · Aleksandr Nogikh

The usbtest driver relies on the driver_info field of struct usb_device_id to point to a valid struct usbtest_info descriptor. This structure contains essential test configurations, such as endpoint addresses and test modes, which are required during probe.

When a user dynamically adds a new device ID via the sysfs new_id interface without specifying a reference device, the USB core initializes driver_info to 0 (NULL). When a matching device is subsequently probed, usbtest_probe() unconditionally casts driver_info to a struct usbtest_info pointer and dereferences it, leading to a NULL pointer dereference crash:

  Oops: general protection fault, probably for non-canonical address
  0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
  RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822

Because usbtest strictly requires pre-defined usbtest_info descriptors to function, dynamic ID binding via sysfs is fundamentally unsupported for this driver.

Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs the USB core to skip creating the new_id and remove_id sysfs interfaces for usbtest, preventing invalid dynamic ID entries from being created.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Shouldn't this also get a cc: stable?

Is there (in general) value in cc: stable without a Fixes: tag?

Very much so. Don't you want this in stable trees so that your syzbot runs on the older kernels don't fail horribly? If not, then hey, waiting for newer releases is fine with me, but I got the impression this was a good thing to fix :)

I see, thanks for the clarification!
I've sent a v3 that Cc's stable.

Quoted 4 lines

thanks,

greg k-h

syzbot Tested-by [email protected] on v2 1/1
#9 lore raw

[syzbot ci] Re: usb: usbtest: disable dynamic ID support

In reply to Aleksandr Nogikh
syzbot ci has tested the following series

syzbot ci has tested the following series

[v2] usb: usbtest: disable dynamic ID support
https://lore.kernel.org/all/[email protected]
* [PATCH v2] usb: usbtest: disable dynamic ID support

and found no issues.

Full report is available here:
https://ci.syzbot.org/series/97f82df9-c73a-4096-9895-f64c7015efa5

***

If these findings have caused you to resend the series or submit a separate fix, please add the following tag to your commit message:

---
This report is generated by a bot. It may contain errors. syzbot ci engineers can be reached at [email protected].

#10 lore raw

PATCH v3 1/1 usb: usbtest: disable dynamic ID support

In reply to Greg Kroah-Hartman

The usbtest driver relies on the driver_info field of struct usb_device_id to point to a valid struct usbtest_info descriptor. This structure contains essential test configurations, such as endpoint addresses and test modes, which are required during probe.

When a user dynamically adds a new device ID via the sysfs new_id interface without specifying a reference device, the USB core initializes driver_info to 0 (NULL). When a matching device is subsequently probed, usbtest_probe() unconditionally casts driver_info to a struct usbtest_info pointer and dereferences it, leading to a NULL pointer dereference crash:

  Oops: general protection fault, probably for non-canonical address
  0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
  RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822

Because usbtest strictly requires pre-defined usbtest_info descriptors to function, dynamic ID binding via sysfs is fundamentally unsupported for this driver.

Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs the USB core to skip creating the new_id and remove_id sysfs interfaces for usbtest, preventing invalid dynamic ID entries from being created.

---
Changes in v3:
- Cc stable.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Disable dynamic IDs via .no_dynamic_id = 1 instead of adding a runtime NULL check in probe().
- Link to v1: https://lore.kernel.org/r/[email protected]

 drivers/usb/misc/usbtest.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/misc/usbtest.c +1 -0
index 98071b25ac076..8759df49be287 100644
@@ -3054,6 +3054,7 @@ static struct usb_driver usbtest_driver = {
 	.disconnect =	usbtest_disconnect,
 	.suspend =	usbtest_suspend,
 	.resume =	usbtest_resume,
+	.no_dynamic_id = 1,
 };
 
 /*-------------------------------------------------------------------------*/
Signature · 3 lines
base-commit: 48a5a7ab8d6ab7090564339e039c421f315de912
-- 
2.55.0.654.g21b8a5bc05-goog
syzbot Tested-by [email protected] on v3 1/1
#11 lore raw

[syzbot ci] Re: usb: usbtest: disable dynamic ID support

syzbot ci has tested the following series

syzbot ci has tested the following series

[v3] usb: usbtest: disable dynamic ID support
https://lore.kernel.org/all/[email protected]
* [PATCH v3] usb: usbtest: disable dynamic ID support

and found no issues.

Full report is available here:
https://ci.syzbot.org/series/de685b28-f615-42d9-ba4b-01110fee0f94

***

If these findings have caused you to resend the series or submit a separate fix, please add the following tag to your commit message:

---
This report is generated by a bot. It may contain errors. syzbot ci engineers can be reached at [email protected].