Skip to contentSkip to conversation

usb: storage: continue probe on "Invalid device"

PATCH Superseded Janne Grunau 3 participants 9 messages Aug 10, 2022 – Nov 4, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

 common/usb_storage.c | 1 +
 1 file changed, 1 insertion(+)
common/usb_storage.c +1 -0
index eaa31374ef73..f9204552a683 100644
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
 			ret = device_unbind(dev);
 			if (ret)
 				return ret;
+			continue;
 		}
 
 		ret = blk_probe_or_unbind(dev);
Signature · 1 line
2.35.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

Quoted 6 lines

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

 common/usb_storage.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 16 lines
common/usb_storage.c +1 -1
index eaa31374ef73..f9204552a683 100644
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
                        ret = device_unbind(dev);
                        if (ret)
                                return ret;
+                       continue;
                }
 
                ret = blk_probe_or_unbind(dev);
--

2.35.1

#2 lore raw
In reply to Janne Grunau
Quoted 17 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

 common/usb_storage.c | 1 +
 1 file changed, 1 insertion(+)
common/usb_storage.c +0 -0
index eaa31374ef73..f9204552a683 100644

common/usb_storage.c static int usb_stor_probe_device(struct usb_device *udev) · line 245

Quoted 7 lines
common/usb_storage.c +1 -0
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
 			ret = device_unbind(dev);
 			if (ret)
 				return ret;
+			continue;
 		}
 
 		ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

Thanks,
Janne

#3 lore raw

+Marek Vasut
+Tom Rini

Quoted 31 lines · Janne Grunau
Quoted 17 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

 common/usb_storage.c | 1 +
 1 file changed, 1 insertion(+)
common/usb_storage.c +0 -0
index eaa31374ef73..f9204552a683 100644

common/usb_storage.c static int usb_stor_probe_device(struct usb_device *udev) · line 245

Quoted 7 lines
common/usb_storage.c +1 -0
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
                      ret = device_unbind(dev);
                      if (ret)
                              return ret;
+                     continue;
              }
 
              ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

Thanks,
Janne

#4 lore raw
Quoted 29 lines · Simon Glass
(quoted diff) +2 -0
+Marek Vasut
+Tom Rini
Quoted 25 lines · Janne Grunau
Quoted 23 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

 common/usb_storage.c | 1 +
 1 file changed, 1 insertion(+)
common/usb_storage.c +1 -0
index eaa31374ef73..f9204552a683 100644
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
                      ret = device_unbind(dev);
                      if (ret)
                              return ret;
+                     continue;
              }
 
Quoted 3 lines
Quoted 3 lines

common/usb_storage.c static int usb_stor_probe_device(struct usb_device *udev) · line 245

Quoted 1 line
common/usb_storage.c +0 -0
              ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

ping2

This fixes a 100% reproducible crash when an USB storage device with "medium not ready" is connected.

Janne

#5 lore raw
Quoted 30 lines · Janne Grunau
Quoted 29 lines · Simon Glass
(quoted diff) +2 -0
+Marek Vasut
+Tom Rini
Quoted 25 lines · Janne Grunau
Quoted 23 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

  common/usb_storage.c | 1 +
  1 file changed, 1 insertion(+)
common/usb_storage.c +1 -0
index eaa31374ef73..f9204552a683 100644
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
                       ret = device_unbind(dev);
                       if (ret)
                               return ret;
+                     continue;
               }
 
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

common/usb_storage.c static int usb_stor_probe_device(struct usb_device *udev) · line 245

Quoted 1 line
common/usb_storage.c +0 -0
               ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

ping2

This fixes a 100% reproducible crash when an USB storage device with "medium not ready" is connected.

Can you please CC me next time when submitting these kinds of USB fixes ?

Also, can you tell which device this is ?

Reviewed-by
#6 lore raw
Quoted 36 lines · Marek Vasut
Quoted 35 lines · Janne Grunau
Quoted 33 lines · Simon Glass
(quoted diff) +2 -0
+Marek Vasut
+Tom Rini
Quoted 29 lines · Janne Grunau
Quoted 24 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
  - changed unconditiona return to "continue" as proposed by AKASHI Takahiro

  common/usb_storage.c | 1 +

  1 file changed, 1 insertion(+)
common/usb_storage.c +1 -0
index eaa31374ef73..f9204552a683 100644
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct 
 usb_device *udev)
                        ret = device_unbind(dev);
                        if (ret)
                                return ret;
+                     continue;
                }
 
Quoted 1 line

               ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

Quoted 8 lines
Quoted 4 lines

ping2

This fixes a 100% reproducible crash when an USB storage device with "medium not ready" is connected.

Can you please CC me next time when submitting these kinds of USB fixes ?

Also, can you tell which device this is ?

Reading through the rest of the links, can you please just fill in details of the USB card reader for future reference (like lsusb -vvvn or similar). And then send V3 with my:

#7 lore raw
In reply to Marek Vasut
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Janne Grunau
Quoted 32 lines · Simon Glass
(quoted diff) +2 -0
+Marek Vasut
+Tom Rini
Quoted 28 lines · Janne Grunau
Quoted 17 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

  common/usb_storage.c | 1 +
  1 file changed, 1 insertion(+)
common/usb_storage.c +0 -0
index eaa31374ef73..f9204552a683 100644

common/usb_storage.c static int usb_stor_probe_device(struct usb_device *udev) · line 245

Quoted 7 lines
common/usb_storage.c +1 -0
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
                       ret = device_unbind(dev);
                       if (ret)
                               return ret;
+                     continue;
               }
 
               ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

Quoted 6 lines
Quoted 4 lines

ping2

This fixes a 100% reproducible crash when an USB storage device with "medium not ready" is connected.

Can you please CC me next time when submitting these kinds of USB fixes ?

sure, the cc list was the get_maintainers.pl output.

Quoted 1 line

Also, can you tell which device this is ?

I don't think the device matters but I'm seeing this problem with

Bus 002 Device 005: ID 0bda:0326 Realtek Semiconductor Corp. Card reader Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol
0 bMaxPacketSize0 9
idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24

  iManufacturer           1 Realtek
  iProduct                2 USB3.0 Card Reader
  iSerial                 3 201404081410
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x002c
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 CARD READER
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 800mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 5 Bulk-In, Bulk-Out, Interface
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 7
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 7
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x0016
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x0000f41e
BESL Link Power Management (LPM) Supported
BESL value 1024 us Deep BESL value 61440 us SuperSpeed USB
Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x02
Latency Tolerance Messages (LTM) Supported
wSpeedsSupported 0x000e
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 10 micro seconds
bU2DevExitLat 1023 micro seconds
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x001c
(Bus Powered)
U1 Enabled
U2 Enabled
Latency Tolerance Messaging (LTM) Enabled

#8 lore raw
Quoted 36 lines · Janne Grunau
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Janne Grunau
Quoted 32 lines · Simon Glass
(quoted diff) +2 -0
+Marek Vasut
+Tom Rini
Quoted 28 lines · Janne Grunau
Quoted 17 lines · Janne Grunau

Fixes a crash during probing of sd card readers without medium present.

---
Changes since v1:
- changed unconditiona return to "continue" as proposed by AKASHI Takahiro

   common/usb_storage.c | 1 +
   1 file changed, 1 insertion(+)
common/usb_storage.c +0 -0
index eaa31374ef73..f9204552a683 100644

common/usb_storage.c static int usb_stor_probe_device(struct usb_device *udev) · line 245

Quoted 7 lines
common/usb_storage.c +1 -0
@@ -239,6 +239,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
                        ret = device_unbind(dev);
                        if (ret)
                                return ret;
+                     continue;
                }
 
                ret = blk_probe_or_unbind(dev);

ping. Is there anything holding up merging this fix?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

ping2

This fixes a 100% reproducible crash when an USB storage device with "medium not ready" is connected.

Can you please CC me next time when submitting these kinds of USB fixes ?

sure, the cc list was the get_maintainers.pl output.

Ah, the MAINTAINERS entry is wrong, fix is out, thanks.

Quoted 4 lines
Quoted 1 line

Also, can you tell which device this is ?

I don't think the device matters but I'm seeing this problem with

Quoted 9 lines

Bus 002 Device 005: ID 0bda:0326 Realtek Semiconductor Corp. Card reader Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol
0 bMaxPacketSize0 9
idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader

I'll see if I can get one of these for testing, thanks.