USB: misc/vstusb, fix lock imbalance

Make sure we don't leak locked vstdev->lock in vstusb_write. Unlock
properly on one fail path.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Jiri Slaby 2009-03-11 21:47:39 +01:00 committed by Greg Kroah-Hartman
parent 46c9844c40
commit a08b43aee4

View File

@ -401,6 +401,7 @@ static ssize_t vstusb_write(struct file *file, const char __user *buffer,
} }
if (copy_from_user(buf, buffer, count)) { if (copy_from_user(buf, buffer, count)) {
mutex_unlock(&vstdev->lock);
dev_err(&dev->dev, "%s: can't copy_from_user\n", __func__); dev_err(&dev->dev, "%s: can't copy_from_user\n", __func__);
retval = -EFAULT; retval = -EFAULT;
goto exit; goto exit;