Showing error 938

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: drivers/usb/misc/vstusb.c
Line in file: 433
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by a08b43aee46ed4272ad7bee2c785edcf313339b3
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

403        if (copy_from_user(buf, buffer, count)) {
404                dev_err(&dev->dev, "%s: can't copy_from_user\n", __func__);
405                retval = -EFAULT;
406                goto exit;
407        }
408
409        usb_anchor_urb(urb, &vstdev->submitted);
410        retval = vstusb_fill_and_send_urb(urb, dev, pipe, buf, count, &done);
411        mutex_unlock(&vstdev->lock);
412        if (retval) {
413                usb_unanchor_urb(urb);
414                dev_err(&dev->dev, "%s: error %d filling and sending urb %d\n",
415                        __func__, retval, pipe);
416                goto exit;
417        }
418
419        retval = vstusb_complete_urb(urb, &done, timeout, &cnt);
420        if (retval) {
421                dev_err(&dev->dev, "%s: error %d completing urb %d\n",
422                        __func__, retval, pipe);
423                goto exit;
424        } else {
425                retval = cnt;
426                dev_dbg(&dev->dev, "%s: sent %d bytes to pipe %d\n",
427                        __func__, cnt, pipe);
428        }
429
430exit:
431        usb_free_urb(urb);
432        kfree(buf);
433        return retval;
434}
435
436static long vstusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
437{
438        int retval = 0;
439        int cnt = -1;
440        void __user *data = (void __user *)arg;
441        struct vstusb_args usb_data;
442
443        struct vstusb_device *vstdev;
Show full sources