diff mbox

vfs: fix missing unlock on error in simple_xattr_list()

Message ID 1454680202-17959-1-git-send-email-weiyj_lk@163.com (mailing list archive)
State New, archived
Headers show

Commit Message

weiyj_lk@163.com Feb. 5, 2016, 1:50 p.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing unlock before return from function simple_xattr_list()
in the error handling case.

Fixes: 786534b92f3c (tmpfs: listxattr should include POSIX ACL xattrs)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 fs/xattr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andreas Grünbacher Feb. 5, 2016, 3:51 p.m. UTC | #1
2016-02-05 14:50 GMT+01:00  <weiyj_lk@163.com>:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add the missing unlock before return from function simple_xattr_list()
> in the error handling case.

Thanks, this is equivalent to the fix already posted under the subject:

  [PATCH] xattr handlers: plug a lock leak in simple_xattr_list

Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Al Viro Feb. 5, 2016, 4:33 p.m. UTC | #2
On Fri, Feb 05, 2016 at 04:51:51PM +0100, Andreas Grünbacher wrote:
> 2016-02-05 14:50 GMT+01:00  <weiyj_lk@163.com>:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> >
> > Add the missing unlock before return from function simple_xattr_list()
> > in the error handling case.
> 
> Thanks, this is equivalent to the fix already posted under the subject:
> 
>   [PATCH] xattr handlers: plug a lock leak in simple_xattr_list

... and will be pushed into #for-linus later today, once I sort out what
the hell is going on with xfstests ;-/  This patch is obviously not the
source of problems I'm seeing, but I'd like to figure out what _is_...
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xattr.c b/fs/xattr.c
index 07d0e47..d4f8487 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -964,8 +964,10 @@  ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,
 			continue;
 
 		err = xattr_list_one(&buffer, &remaining_size, xattr->name);
-		if (err)
+		if (err) {
+			spin_unlock(&xattrs->lock);
 			return err;
+		}
 	}
 	spin_unlock(&xattrs->lock);