Showing error 640

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


Source:

565        int error;
566        struct request sreq ;
567        struct task_struct *thread;
568
569        if (!capable(CAP_SYS_ADMIN))
570                return -EPERM;
571
572        BUG_ON(lo->magic != LO_MAGIC);
573
574        /* Anyone capable of this syscall can do *real bad* things */
575        dprintk(DBG_IOCTL, "%s: nbd_ioctl cmd=%s(0x%x) arg=%lu\n",
576                        lo->disk->disk_name, ioctl_cmd_to_ascii(cmd), cmd, arg);
577
578        switch (cmd) {
579        case NBD_DISCONNECT:
580                printk(KERN_INFO "%s: NBD_DISCONNECT\n", lo->disk->disk_name);
581                blk_rq_init(NULL, &sreq);
582                sreq.cmd_type = REQ_TYPE_SPECIAL;
583                nbd_cmd(&sreq) = NBD_CMD_DISC;
584                /*
585                 * Set these to sane values in case server implementation
586                 * fails to check the request type first and also to keep
587                 * debugging output cleaner.
588                 */
589                sreq.sector = 0;
590                sreq.nr_sectors = 0;
591                if (!lo->sock)
592                        return -EINVAL;
593                mutex_lock(&lo->tx_lock);
594                nbd_send_req(lo, &sreq);
595                mutex_unlock(&lo->tx_lock);
596                return 0;
597 
598        case NBD_CLEAR_SOCK:
599                error = 0;
600                mutex_lock(&lo->tx_lock);
601                lo->sock = NULL;
602                mutex_unlock(&lo->tx_lock);
603                file = lo->file;
604                lo->file = NULL;
605                nbd_clear_que(lo);
Show full sources