From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dr. David Alan Gilbert" Subject: [PATCH] hpfs_setattr error case avoids unlock_kernel Date: Mon, 13 Dec 2010 17:09:52 +0000 Message-ID: <20101213170952.GA29037@gallifrey> References: <20101212004947.GA9138@gallifrey> <20101213160304.GA6238@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: mikulas@artax.karlin.mff.cuni.cz, linux-fsdevel@vger.kernel.org To: Christoph Hellwig Return-path: Received: from mx.treblig.org ([80.68.94.177]:46276 "EHLO mx.treblig.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751783Ab0LMRJy (ORCPT ); Mon, 13 Dec 2010 12:09:54 -0500 Content-Disposition: inline In-Reply-To: <20101213160304.GA6238@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: * Christoph Hellwig (hch@lst.de) wrote: > On Sun, Dec 12, 2010 at 12:49:47AM +0000, Dr. David Alan Gilbert wrote: > > it looks like that 1st 'return error' needs to change into a goto out_unlock; > > Yes. Care to send a patch to fix it? This fixed a case that 'sparse' spotted where hpfs_setattr has an error return that didn't go through it's path that unlocks. This is against git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git version 6313e3c21743cc88bb5bd8aa72948ee1e83937b6. Build tested only, I don't have an hpfs file system to test. Dave Signed-off-by: Dr. David Alan Gilbert --- diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 56f0da1..1ae35ba 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c @@ -281,7 +281,7 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr) attr->ia_size != i_size_read(inode)) { error = vmtruncate(inode, attr->ia_size); if (error) - return error; + goto out_unlock; } setattr_copy(inode, attr); -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ gro.gilbert @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/