]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
USB: legousbtower: fix memleak on disconnect
authorJohan Hovold <johan@kernel.org>
Thu, 10 Oct 2019 12:58:35 +0000 (14:58 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 18:04:43 +0000 (19:04 +0100)
BugLink: https://bugs.launchpad.net/bugs/1851876
commit b6c03e5f7b463efcafd1ce141bd5a8fc4e583ae2 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: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191010125835.27031-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/misc/legousbtower.c

index 5418f3a8c50ab5f9ec1aeec118d95dcfd939b3ac..28aefa5ae8cb502b308b5a261946a830e7836a23 100644 (file)
@@ -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",