mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 16:53:58 -05:00
xattr handlers: plug a lock leak in simple_xattr_list
The code could leak xattrs->lock on error.
Problem introduced with 786534b92f
"tmpfs: listxattr should
include POSIX ACL xattrs".
Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
2feb55f890
commit
0e9a7da51b
1 changed files with 3 additions and 3 deletions
|
@ -940,7 +940,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,
|
||||||
bool trusted = capable(CAP_SYS_ADMIN);
|
bool trusted = capable(CAP_SYS_ADMIN);
|
||||||
struct simple_xattr *xattr;
|
struct simple_xattr *xattr;
|
||||||
ssize_t remaining_size = size;
|
ssize_t remaining_size = size;
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_FS_POSIX_ACL
|
#ifdef CONFIG_FS_POSIX_ACL
|
||||||
if (inode->i_acl) {
|
if (inode->i_acl) {
|
||||||
|
@ -965,11 +965,11 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,
|
||||||
|
|
||||||
err = xattr_list_one(&buffer, &remaining_size, xattr->name);
|
err = xattr_list_one(&buffer, &remaining_size, xattr->name);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
break;
|
||||||
}
|
}
|
||||||
spin_unlock(&xattrs->lock);
|
spin_unlock(&xattrs->lock);
|
||||||
|
|
||||||
return size - remaining_size;
|
return err ? err : size - remaining_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue