USB: atm/cxacru, fix lock imbalance
Subsystems (3)
PATCH 1/5 USB: atm/cxacru, fix lock imbalance
We do not hold mutex in one place in cxacru_cm, but unlock it on fail path. Fix this.
Signed-off-by Jiri Slaby <[email protected]>
Cc Simon Arlott <[email protected]>
--- drivers/usb/atm/cxacru.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/atm/cxacru.c +2 -1
@@ -485,7 +485,7 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,usb_err (instance->usbatm,"requested transfer size too large (%d, %d)\n" , wbuflen, rbuflen); ret = -ENOMEM ; - goto fail; + goto err; }mutex_lock (&instance->cm_serialize);
@@ -565,6 +565,7 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,dbg ("cm %#x" , cm); fail:mutex_unlock (&instance->cm_serialize); +err:return ret; }
Signature · 2 lines
1.6.2 caught by stanse
PATCH 2/5 USB: image/mdc800, fix lock imbalance
There is an omitted unlock in mdc800_usb_probe's fail path. Add it.
Signed-off-by Jiri Slaby <[email protected]>
Cc Henning Zabel <[email protected]>
--- drivers/usb/image/mdc800.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/image/mdc800.c +1 -0
@@ -499,6 +499,7 @@ static int mdc800_usb_probe (struct usb_interface *intf, retval =usb_register_dev (intf, &mdc800_class);if (retval) {dev_err (&intf->dev,"Not able to get a minor for this device.\n" ); +mutex_unlock (&mdc800->io_lock);return -ENODEV ; }
Signature · 2 lines
1.6.2 caught by stanse
PATCH 3/5 USB: misc/adutux, fix lock imbalance
In reply to Jiri SlabyDon't unlock adutux_mutex when not held.
Signed-off-by Jiri Slaby <[email protected]>
--- drivers/usb/misc/adutux.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/misc/adutux.c +3 -3
@@ -376,7 +376,7 @@ static int adu_release(struct inode *inode, struct file *file)if (dev->open_count <=0 ) {dbg (1 ," %s : device not opened" , __func__); retval = -ENODEV ; - goto exit; + goto unlock; }adu_release_internal (dev);
@@ -385,9 +385,9 @@ static int adu_release(struct inode *inode, struct file *file)if (!dev->open_count)/* ... and we're the last user */ adu_delete (dev); } - -exit: +unlock:mutex_unlock (&adutux_mutex); +exit:dbg (2 ," %s : leave, return value %d" , __func__, retval);return retval; }
Signature · 2 lines
1.6.2 caught by stanse
PATCH 4/5 USB: misc/vstusb, fix lock imbalance
In reply to Jiri SlabyMake sure we don't leak locked vstdev->lock in vstusb_write. Unlock properly on one fail path.
Signed-off-by Jiri Slaby <[email protected]>
--- drivers/usb/misc/vstusb.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/misc/vstusb.c +1 -0
@@ -401,6 +401,7 @@ static ssize_t vstusb_write(struct file *file, const char __user *buffer, }if (copy_from_user (buf, buffer, count)) { +mutex_unlock (&vstdev->lock);dev_err (&dev->dev,"%s: can't copy_from_user\n" , __func__); retval = -EFAULT ; goto exit;
Signature · 2 lines
1.6.2 caught by stanse
PATCH 5/5 USB: wusbcore/wa-xfer, fix lock imbalance
In reply to Jiri SlabyFix locking on one wa_urb_enqueue_b's fail path. There was omitted unlock.
Signed-off-by Jiri Slaby <[email protected]>
Cc Inaky Perez-Gonzalez <[email protected]>
--- drivers/usb/wusbcore/wa-xfer.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/wusbcore/wa-xfer.c +3 -1
@@ -921,8 +921,10 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer) result = -ENODEV ;/* FIXME: segmentation broken -- kills DWA */ mutex_lock (&wusbhc->mutex);/* get a WUSB dev */ -if (urb->dev ==NULL ) +if (urb->dev ==NULL ) { +mutex_unlock (&wusbhc->mutex); goto error_dev_gone; + } wusb_dev =__wusb_dev_get_by_usb_dev (wusbhc, urb->dev);if (wusb_dev ==NULL ) {mutex_unlock (&wusbhc->mutex);
Signature · 2 lines
1.6.2 caught by stanse