Showing error 1571

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/block/nbd.c
Line in file: 609
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-05-29 20:11:37 UTC


Source:

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);
606                BUG_ON(!list_empty(&lo->queue_head));
607                if (file)
608                        fput(file);
609                return error;
610        case NBD_SET_SOCK:
611                if (lo->file)
612                        return -EBUSY;
613                error = -EINVAL;
614                file = fget(arg);
615                if (file) {
616                        struct inode *inode = file->f_path.dentry->d_inode;
617                        if (S_ISSOCK(inode->i_mode)) {
618                                lo->file = file;
619                                lo->sock = SOCKET_I(inode);
Show full sources