staging: mei: unlock dev->device_lock mutex on error path in mei_open()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Tue, 30 Aug 2011 20:41:14 +0000 (00:41 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 23:49:27 +0000 (16:49 -0700)
mei_open() acquires dev->device_lock mutex and try to allocate mei_cl,
but if the allocation fails it goes to return statement. As a result
dev->device_lock left locked.

The patch fixes goto to unlock dev->device_lock mutex on this path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/mei/main.c

index 8d76785..78028f8 100644 (file)
@@ -413,7 +413,7 @@ static int mei_open(struct inode *inode, struct file *file)
        err = -ENOMEM;
        cl = mei_cl_allocate(dev);
        if (!cl)
-               goto out;
+               goto out_unlock;
 
        err = -ENODEV;
        if (dev->mei_state != MEI_ENABLED) {