[PATCH 7/9] missing unlock in jfs_quota_write()

[email protected] Wed, 17 Jun 2009 08:44:30 -0500 (CDT)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
commit 9c83633ad38138855181af6936e8ac570ef7e2cb
Author: Dan Carpenter <[email protected]>
Date:   Tue Apr 7 14:48:16 2009 +0300

    missing unlock in jfs_quota_write()
    
    We should unlock &inode->i_mutex on the error path.  This bug was
    in ext2_quota_write().  I sent a patch to them today as well.
    
    Found by smatch (http://repo.or.cz/w/smatch.git).  Compile tested.
    
    regards,
    dan carpenter
    
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>

diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 6f21adf..d9b0e92 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -720,8 +720,10 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
 		blk++;
 	}
 out:
-	if (len == towrite)
+	if (len == towrite) {
+		mutex_unlock(&inode->i_mutex);
 		return err;
+	}
 	if (inode->i_size < off+len-towrite)
 		i_size_write(inode, off+len-towrite);
 	inode->i_version++;

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects