All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs: zero out when listxattr is called with no xattr
       [not found] <20191201084040.29275-1-hsiangkao.ref@aol.com>
@ 2019-12-01  8:40   ` Gao Xiang via Linux-erofs
  0 siblings, 0 replies; 7+ messages in thread
From: Gao Xiang @ 2019-12-01  8:40 UTC (permalink / raw)
  To: Chao Yu, linux-erofs
  Cc: LKML, David Michael, Miao Xie, Fang Wei, Wang Li, Gao Xiang, stable

From: Gao Xiang <gaoxiang25@huawei.com>

As David reported [1], ENODATA returns when attempting
to modify files by using EROFS as a overlayfs lower layer.

The root cause is that listxattr could return unexpected
-ENODATA by mistake for inodes without xattr. That breaks
listxattr return value convention and it can cause copy
up failure when used with overlayfs.

Resolve by zeroing out if no xattr is found for listxattr.

[1] https://lore.kernel.org/r/CAEvUa7nxnby+rxK-KRMA46=exeOMApkDMAV08AjMkkPnTPV4CQ@mail.gmail.com
Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
Cc: <stable@vger.kernel.org> # 4.19+
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 fs/erofs/xattr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index a13a78725c57..b766c3ee5fa8 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -649,6 +649,8 @@ ssize_t erofs_listxattr(struct dentry *dentry,
 	struct listxattr_iter it;
 
 	ret = init_inode_xattrs(d_inode(dentry));
+	if (ret == -ENOATTR)
+		return 0;
 	if (ret)
 		return ret;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] erofs: zero out when listxattr is called with no xattr
@ 2019-12-01  8:40   ` Gao Xiang via Linux-erofs
  0 siblings, 0 replies; 7+ messages in thread
From: Gao Xiang via Linux-erofs @ 2019-12-01  8:40 UTC (permalink / raw)
  To: Chao Yu, linux-erofs; +Cc: David Michael, LKML, stable, Wang Li, Miao Xie

From: Gao Xiang <gaoxiang25@huawei.com>

As David reported [1], ENODATA returns when attempting
to modify files by using EROFS as a overlayfs lower layer.

The root cause is that listxattr could return unexpected
-ENODATA by mistake for inodes without xattr. That breaks
listxattr return value convention and it can cause copy
up failure when used with overlayfs.

Resolve by zeroing out if no xattr is found for listxattr.

[1] https://lore.kernel.org/r/CAEvUa7nxnby+rxK-KRMA46=exeOMApkDMAV08AjMkkPnTPV4CQ@mail.gmail.com
Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
Cc: <stable@vger.kernel.org> # 4.19+
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 fs/erofs/xattr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index a13a78725c57..b766c3ee5fa8 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -649,6 +649,8 @@ ssize_t erofs_listxattr(struct dentry *dentry,
 	struct listxattr_iter it;
 
 	ret = init_inode_xattrs(d_inode(dentry));
+	if (ret == -ENOATTR)
+		return 0;
 	if (ret)
 		return ret;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] erofs: zero out when listxattr is called with no xattr
  2019-12-01  8:40   ` Gao Xiang via Linux-erofs
  (?)
@ 2019-12-02 22:13   ` Sasha Levin
  2019-12-03  1:52       ` Gao Xiang
  -1 siblings, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2019-12-02 22:13 UTC (permalink / raw)
  To: Sasha Levin, Gao Xiang, Gao Xiang, Chao Yu, linux-erofs; +Cc: , LKML, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule").

The bot has tested the following trees: v5.4.1, v5.3.14, v4.19.87.

v5.4.1: Build OK!
v5.3.14: Failed to apply! Possible dependencies:
    Unable to calculate

v4.19.87: Failed to apply! Possible dependencies:
    Unable to calculate


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] erofs: zero out when listxattr is called with no xattr
  2019-12-02 22:13   ` Sasha Levin
@ 2019-12-03  1:52       ` Gao Xiang
  0 siblings, 0 replies; 7+ messages in thread
From: Gao Xiang @ 2019-12-03  1:52 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Gao Xiang, Chao Yu, linux-erofs, LKML, stable, Miao Xie

Hi Sasha,

On Mon, Dec 02, 2019 at 10:13:11PM +0000, Sasha Levin wrote:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule").
> 
> The bot has tested the following trees: v5.4.1, v5.3.14, v4.19.87.
> 
> v5.4.1: Build OK!
> v5.3.14: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.19.87: Failed to apply! Possible dependencies:
>     Unable to calculate

Because of file movement, I'll backport manually then.

Thanks,
Gao Xiang

> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?
> 
> -- 
> Thanks,
> Sasha

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] erofs: zero out when listxattr is called with no xattr
@ 2019-12-03  1:52       ` Gao Xiang
  0 siblings, 0 replies; 7+ messages in thread
From: Gao Xiang @ 2019-12-03  1:52 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Miao Xie, LKML, stable, linux-erofs

Hi Sasha,

On Mon, Dec 02, 2019 at 10:13:11PM +0000, Sasha Levin wrote:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule").
> 
> The bot has tested the following trees: v5.4.1, v5.3.14, v4.19.87.
> 
> v5.4.1: Build OK!
> v5.3.14: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.19.87: Failed to apply! Possible dependencies:
>     Unable to calculate

Because of file movement, I'll backport manually then.

Thanks,
Gao Xiang

> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?
> 
> -- 
> Thanks,
> Sasha

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] erofs: zero out when listxattr is called with no xattr
  2019-12-01  8:40   ` Gao Xiang via Linux-erofs
@ 2019-12-04  3:14     ` Chao Yu
  -1 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2019-12-04  3:14 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs
  Cc: LKML, David Michael, Miao Xie, Fang Wei, Wang Li, Gao Xiang, stable

On 2019/12/1 16:40, Gao Xiang wrote:
> From: Gao Xiang <gaoxiang25@huawei.com>
> 
> As David reported [1], ENODATA returns when attempting
> to modify files by using EROFS as a overlayfs lower layer.
> 
> The root cause is that listxattr could return unexpected
> -ENODATA by mistake for inodes without xattr. That breaks
> listxattr return value convention and it can cause copy
> up failure when used with overlayfs.
> 
> Resolve by zeroing out if no xattr is found for listxattr.
> 
> [1] https://lore.kernel.org/r/CAEvUa7nxnby+rxK-KRMA46=exeOMApkDMAV08AjMkkPnTPV4CQ@mail.gmail.com
> Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
> Cc: <stable@vger.kernel.org> # 4.19+
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] erofs: zero out when listxattr is called with no xattr
@ 2019-12-04  3:14     ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2019-12-04  3:14 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs; +Cc: David Michael, LKML, stable, Wang Li, Miao Xie

On 2019/12/1 16:40, Gao Xiang wrote:
> From: Gao Xiang <gaoxiang25@huawei.com>
> 
> As David reported [1], ENODATA returns when attempting
> to modify files by using EROFS as a overlayfs lower layer.
> 
> The root cause is that listxattr could return unexpected
> -ENODATA by mistake for inodes without xattr. That breaks
> listxattr return value convention and it can cause copy
> up failure when used with overlayfs.
> 
> Resolve by zeroing out if no xattr is found for listxattr.
> 
> [1] https://lore.kernel.org/r/CAEvUa7nxnby+rxK-KRMA46=exeOMApkDMAV08AjMkkPnTPV4CQ@mail.gmail.com
> Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
> Cc: <stable@vger.kernel.org> # 4.19+
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-04  3:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191201084040.29275-1-hsiangkao.ref@aol.com>
2019-12-01  8:40 ` [PATCH] erofs: zero out when listxattr is called with no xattr Gao Xiang
2019-12-01  8:40   ` Gao Xiang via Linux-erofs
2019-12-02 22:13   ` Sasha Levin
2019-12-03  1:52     ` Gao Xiang
2019-12-03  1:52       ` Gao Xiang
2019-12-04  3:14   ` Chao Yu
2019-12-04  3:14     ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.