Linux-EROFS Archive on
 help / color / Atom feed
From: Gao Xiang via Linux-erofs <>
To: Chao Yu <>,
Cc: David Michael <>,
	LKML <>,, Wang Li <>,
	Miao Xie <>
Subject: [PATCH] erofs: zero out when listxattr is called with no xattr
Date: Sun,  1 Dec 2019 16:40:40 +0800
Message-ID: <> (raw)
In-Reply-To: <>

From: Gao Xiang <>

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.

Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
Cc: <> # 4.19+
Signed-off-by: Gao Xiang <>
 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;

       reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2019-12-01  8:40 ` Gao Xiang via Linux-erofs [this message]
2019-12-02 22:13   ` Sasha Levin
2019-12-03  1:52     ` Gao Xiang
2019-12-04  3:14   ` Chao Yu

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-EROFS Archive on

Archives are clonable:
	git clone --mirror linux-erofs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-erofs linux-erofs/ \
	public-inbox-index linux-erofs

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone