Skip to contentSkip to conversation

USB: misc: more disconnect fixes

PATCH New Johan Hovold 1 participant 3 messages Oct 10, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover USB: misc: more disconnect fixes

Turns out we have more gems in these old drivers.

Johan

Johan Hovold (2):
USB: ldusb: fix memleak on disconnect
USB: legousbtower: fix memleak on disconnect

 drivers/usb/misc/ldusb.c        | 5 +----
 drivers/usb/misc/legousbtower.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/2 USB: ldusb: fix memleak on disconnect

If disconnect() races with release() after a process has been interrupted, release() could end up returning early and the driver would fail to free its driver data.

Fixes 2824bd250f0b ("[PATCH] USB: add ldusb driver")
Cc stable <[email protected]> # 2.6.13
---
 drivers/usb/misc/ldusb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/usb/misc/ldusb.c +1 -4
index f3108d85e768..147c90c2a4e5 100644
@@ -380,10 +380,7 @@ static int ld_usb_release(struct inode *inode, struct file *file)
 		goto exit;
 	}
 
-	if (mutex_lock_interruptible(&dev->mutex)) {
-		retval = -ERESTARTSYS;
-		goto exit;
-	}
+	mutex_lock(&dev->mutex);
 
 	if (dev->open_count != 1) {
 		retval = -ENODEV;
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/2 USB: legousbtower: fix memleak on disconnect

In reply to Johan Hovold

If disconnect() races with release() after a process has been interrupted, release() could end up returning early and the driver would fail to free its driver data.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc stable <[email protected]>
---
 drivers/usb/misc/legousbtower.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/usb/misc/legousbtower.c +1 -4
index 9d4c52a7ebe0..62dab2441ec4 100644
@@ -419,10 +419,7 @@ static int tower_release (struct inode *inode, struct file *file)
 		goto exit;
 	}
 
-	if (mutex_lock_interruptible(&dev->lock)) {
-	        retval = -ERESTARTSYS;
-		goto exit;
-	}
+	mutex_lock(&dev->lock);
 
 	if (dev->open_count != 1) {
 		dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n",
Signature · 1 line
2.23.0