diff options
author | Johan Hovold <johan@kernel.org> | 2019-10-10 15:58:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-29 11:15:16 +0300 |
commit | 1b64bc2abc569640e65ab9792850254f46025f5b (patch) | |
tree | d75c7e67d8a7ed6acb087a54453afeabd29845ba | |
parent | afa3bc254e0f054865f8b18d298f273e00c39849 (diff) | |
download | linux-1b64bc2abc569640e65ab9792850254f46025f5b.tar.xz |
USB: ldusb: fix memleak on disconnect
commit b14a39048c1156cfee76228bf449852da2f14df8 upstream.
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>
Link: https://lore.kernel.org/r/20191010125835.27031-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/misc/ldusb.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index eee69c9e9a12..7f4c4a5d9eef 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -384,10 +384,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; |