linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] USB: misc: more disconnect fixes
@ 2019-10-10 12:58 Johan Hovold
  2019-10-10 12:58 ` [PATCH 1/2] USB: ldusb: fix memleak on disconnect Johan Hovold
  2019-10-10 12:58 ` [PATCH 2/2] USB: legousbtower: " Johan Hovold
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2019-10-10 12:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Juergen Stuber, Johan Hovold

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(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] USB: ldusb: fix memleak on disconnect
  2019-10-10 12:58 [PATCH 0/2] USB: misc: more disconnect fixes Johan Hovold
@ 2019-10-10 12:58 ` Johan Hovold
  2019-10-10 12:58 ` [PATCH 2/2] USB: legousbtower: " Johan Hovold
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2019-10-10 12:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Juergen Stuber, Johan Hovold, stable

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 <stable@vger.kernel.org>     # 2.6.13
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/misc/ldusb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index f3108d85e768..147c90c2a4e5 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -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;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] USB: legousbtower: fix memleak on disconnect
  2019-10-10 12:58 [PATCH 0/2] USB: misc: more disconnect fixes Johan Hovold
  2019-10-10 12:58 ` [PATCH 1/2] USB: ldusb: fix memleak on disconnect Johan Hovold
@ 2019-10-10 12:58 ` Johan Hovold
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2019-10-10 12:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Juergen Stuber, Johan Hovold, stable

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 <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/misc/legousbtower.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 9d4c52a7ebe0..62dab2441ec4 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -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",
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-10 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 12:58 [PATCH 0/2] USB: misc: more disconnect fixes Johan Hovold
2019-10-10 12:58 ` [PATCH 1/2] USB: ldusb: fix memleak on disconnect Johan Hovold
2019-10-10 12:58 ` [PATCH 2/2] USB: legousbtower: " Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).