From: Leon Romanovsky USB core does not register DT-disabled interfaces, and an interface whose registration failed stays in the active configuration. USBDEVFS_CONNECT still asks driver core to attach a driver to such an interface: proc_ioctl() device_attach() __device_attach() The interface has no driver-core private data, so the request dereferences a NULL pointer. Return -ENODEV for an unregistered interface. An interface claimed by a sibling driver keeps reporting -EBUSY. Fixes: ef0ff68351be ("driver core: Probe devices asynchronously instead of the driver") Signed-off-by: Leon Romanovsky --- drivers/usb/core/devio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 101cb94254809..1491ba015bcd8 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -2366,10 +2366,12 @@ static int proc_ioctl(struct usb_dev_state *ps, struct usbdevfs_ioctl *ctl) /* let kernel drivers try to (re)bind to the interface */ case USBDEVFS_CONNECT: - if (!intf->dev.driver) - retval = device_attach(&intf->dev); - else + if (intf->dev.driver) retval = -EBUSY; + else if (!device_is_registered(&intf->dev)) + retval = -ENODEV; + else + retval = device_attach(&intf->dev); break; /* talk directly to the interface's driver */ -- 2.56.1