[PATCH]  drivers/media/video: fix lock imbalances in hdpvr-core.c

From: iceberg
Date: Wed Aug 12 2009 - 07:08:26 EST


In ./drivers/media/video/hdpvr/hdpvr-core.c in function
device_authorization:
If after mutex_lock in usb_control_msg returns ret!=46 we go to
label error. In this case before exit from function mutex must be unlocked.

Fix lock imbalances in function device_authorization.

Signed-off-by: Alexander Strakh <strakh@xxxxxxxxx>

---
diff --git a/a/drivers/media/video/hdpvr/hdpvr-core.c
b/b/drivers/media/video/hdpvr/hdpvr-core.c
index 188bd5a..1d03d1c 100644
--- a/a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -126,7 +126,7 @@ static int device_authorization(struct hdpvr_device *dev)
char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
if (!print_buf) {
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
- goto error;
+ return retval;
}
#endif

@@ -188,10 +188,10 @@ static int device_authorization(struct hdpvr_device
*dev)
10000);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"magic request returned %d\n", ret);
- mutex_unlock(&dev->usbc_mutex);

retval = ret != 8;
error:
+ moutex_unlock(&dev->usbc_mutex);
return retval;
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/