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

2016-02-07 Thread James Morris
On Thu, 4 Feb 2016, Andreas Gruenbacher wrote:

> From: Mateusz Guzik 
> 
> The code could leak xattrs->lock on error.
> 
> Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
> include POSIX ACL xattrs".
> 
> Signed-off-by: Mateusz Guzik 
> Signed-off-by: Andreas Gruenbacher 
> Cc:  # 4.4


Acked-by: James Morris 


-- 
James Morris




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

2016-02-07 Thread James Morris
On Thu, 4 Feb 2016, Andreas Gruenbacher wrote:

> From: Mateusz Guzik 
> 
> The code could leak xattrs->lock on error.
> 
> Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
> include POSIX ACL xattrs".
> 
> Signed-off-by: Mateusz Guzik 
> Signed-off-by: Andreas Gruenbacher 
> Cc:  # 4.4


Acked-by: James Morris 


-- 
James Morris




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

2016-02-03 Thread Andreas Gruenbacher
From: Mateusz Guzik 

The code could leak xattrs->lock on error.

Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
include POSIX ACL xattrs".

Signed-off-by: Mateusz Guzik 
Signed-off-by: Andreas Gruenbacher 
Cc:  # 4.4

---
 fs/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 07d0e47..4861322 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -940,7 +940,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct 
simple_xattrs *xattrs,
bool trusted = capable(CAP_SYS_ADMIN);
struct simple_xattr *xattr;
ssize_t remaining_size = size;
-   int err;
+   int err = 0;
 
 #ifdef CONFIG_FS_POSIX_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(, _size, xattr->name);
if (err)
-   return err;
+   break;
}
spin_unlock(>lock);
 
-   return size - remaining_size;
+   return err ? err : size - remaining_size;
 }
 
 /*
-- 
2.5.0



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

2016-02-03 Thread Greg KH
On Thu, Feb 04, 2016 at 02:56:30AM +0100, Mateusz Guzik wrote:
> The code could leak xattrs->lock on error.
> 
> Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
> include POSIX ACL xattrs".
> 
> Signed-off-by: Mateusz Guzik 
> ---
>  fs/xattr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)




This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.




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

2016-02-03 Thread Mateusz Guzik
The code could leak xattrs->lock on error.

Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
include POSIX ACL xattrs".

Signed-off-by: Mateusz Guzik 
---
 fs/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 07d0e47..4861322 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -940,7 +940,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct 
simple_xattrs *xattrs,
bool trusted = capable(CAP_SYS_ADMIN);
struct simple_xattr *xattr;
ssize_t remaining_size = size;
-   int err;
+   int err = 0;
 
 #ifdef CONFIG_FS_POSIX_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(, _size, xattr->name);
if (err)
-   return err;
+   break;
}
spin_unlock(>lock);
 
-   return size - remaining_size;
+   return err ? err : size - remaining_size;
 }
 
 /*
-- 
1.8.3.1



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

2016-02-03 Thread Mateusz Guzik
The code could leak xattrs->lock on error.

Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
include POSIX ACL xattrs".

Signed-off-by: Mateusz Guzik 
---
 fs/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 07d0e47..4861322 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -940,7 +940,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct 
simple_xattrs *xattrs,
bool trusted = capable(CAP_SYS_ADMIN);
struct simple_xattr *xattr;
ssize_t remaining_size = size;
-   int err;
+   int err = 0;
 
 #ifdef CONFIG_FS_POSIX_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(, _size, xattr->name);
if (err)
-   return err;
+   break;
}
spin_unlock(>lock);
 
-   return size - remaining_size;
+   return err ? err : size - remaining_size;
 }
 
 /*
-- 
1.8.3.1



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

2016-02-03 Thread Greg KH
On Thu, Feb 04, 2016 at 02:56:30AM +0100, Mateusz Guzik wrote:
> The code could leak xattrs->lock on error.
> 
> Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
> include POSIX ACL xattrs".
> 
> Signed-off-by: Mateusz Guzik 
> ---
>  fs/xattr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)




This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.




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

2016-02-03 Thread Andreas Gruenbacher
From: Mateusz Guzik 

The code could leak xattrs->lock on error.

Problem introduced with 786534b92f3ce68f4 "tmpfs: listxattr should
include POSIX ACL xattrs".

Signed-off-by: Mateusz Guzik 
Signed-off-by: Andreas Gruenbacher 
Cc:  # 4.4

---
 fs/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 07d0e47..4861322 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -940,7 +940,7 @@ ssize_t simple_xattr_list(struct inode *inode, struct 
simple_xattrs *xattrs,
bool trusted = capable(CAP_SYS_ADMIN);
struct simple_xattr *xattr;
ssize_t remaining_size = size;
-   int err;
+   int err = 0;
 
 #ifdef CONFIG_FS_POSIX_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(, _size, xattr->name);
if (err)
-   return err;
+   break;
}
spin_unlock(>lock);
 
-   return size - remaining_size;
+   return err ? err : size - remaining_size;
 }
 
 /*
-- 
2.5.0