Showing error 644

User: Jiri Slaby
Error type: Double Unlock
Error type description: Some lock is unlocked twice unintentionally in a sequence
File location: drivers/usb/class/usblp.c
Line in file: 849
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:20:57 UTC


Source:

 819
 820        rv = usblp_rwait_and_lock(usblp, !!(file->f_flags & O_NONBLOCK));
 821        if (rv < 0)
 822                return rv;
 823
 824        if ((avail = usblp->rstatus) < 0) {
 825                printk(KERN_ERR "usblp%d: error %d reading from printer\n",
 826                    usblp->minor, (int)avail);
 827                usblp_submit_read(usblp);
 828                count = -EIO;
 829                goto done;
 830        }
 831
 832        count = len < avail - usblp->readcount ? len : avail - usblp->readcount;
 833        if (count != 0 &&
 834            copy_to_user(buffer, usblp->readbuf + usblp->readcount, count)) {
 835                count = -EFAULT;
 836                goto done;
 837        }
 838
 839        if ((usblp->readcount += count) == avail) {
 840                if (usblp_submit_read(usblp) < 0) {
 841                        /* We don't want to leak USB return codes into errno. */
 842                        if (count == 0)
 843                                count = -EIO;
 844                        goto done;
 845                }
 846        }
 847
 848done:
 849        mutex_unlock (&usblp->mut);
 850        return count;
 851}
 852
 853/*
 854 * Wait for the write path to come idle.
 855 * This is called under the ->wmut, so the idle path stays idle.
 856 *
 857 * Our write path has a peculiar property: it does not buffer like a tty,
 858 * but waits for the write to succeed. This allows our ->release to bug out
 859 * without waiting for writes to drain. But it obviously does not work
Show full sources