Showing error 918

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: fs/ext2/super.c
Line in file: 1387
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by a069e9cee1dba2f847839d325f46ce6976ed1b76
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

1357        while (towrite > 0) {
1358                tocopy = sb->s_blocksize - offset < towrite ?
1359                                sb->s_blocksize - offset : towrite;
1360
1361                tmp_bh.b_state = 0;
1362                err = ext2_get_block(inode, blk, &tmp_bh, 1);
1363                if (err < 0)
1364                        goto out;
1365                if (offset || tocopy != EXT2_BLOCK_SIZE(sb))
1366                        bh = sb_bread(sb, tmp_bh.b_blocknr);
1367                else
1368                        bh = sb_getblk(sb, tmp_bh.b_blocknr);
1369                if (!bh) {
1370                        err = -EIO;
1371                        goto out;
1372                }
1373                lock_buffer(bh);
1374                memcpy(bh->b_data+offset, data, tocopy);
1375                flush_dcache_page(bh->b_page);
1376                set_buffer_uptodate(bh);
1377                mark_buffer_dirty(bh);
1378                unlock_buffer(bh);
1379                brelse(bh);
1380                offset = 0;
1381                towrite -= tocopy;
1382                data += tocopy;
1383                blk++;
1384        }
1385out:
1386        if (len == towrite)
1387                return err;
1388        if (inode->i_size < off+len-towrite)
1389                i_size_write(inode, off+len-towrite);
1390        inode->i_version++;
1391        inode->i_mtime = inode->i_ctime = CURRENT_TIME;
1392        mark_inode_dirty(inode);
1393        mutex_unlock(&inode->i_mutex);
1394        return len - towrite;
1395}
1396
1397#endif
Show full sources