From: Gao Xiang via Linux-erofs <linux-erofs@lists.ozlabs.org> To: Chao Yu <yuchao0@huawei.com>, linux-erofs@lists.ozlabs.org Cc: David Michael <fedora.dm0@gmail.com>, LKML <linux-kernel@vger.kernel.org>, stable@vger.kernel.org, Wang Li <wangli74@huawei.com>, Miao Xie <miaoxie@huawei.com> Subject: [PATCH] erofs: zero out when listxattr is called with no xattr Date: Sun, 1 Dec 2019 16:40:40 +0800 Message-ID: <20191201084040.29275-1-hsiangkao@aol.com> (raw) In-Reply-To: <20191201084040.29275-1-hsiangkao.ref@aol.com> 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
next parent reply index Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20191201084040.29275-1-hsiangkao.ref@aol.com> 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: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20191201084040.29275-1-hsiangkao@aol.com \ --to=linux-erofs@lists.ozlabs.org \ --cc=fedora.dm0@gmail.com \ --cc=hsiangkao@aol.com \ --cc=linux-kernel@vger.kernel.org \ --cc=miaoxie@huawei.com \ --cc=stable@vger.kernel.org \ --cc=wangli74@huawei.com \ --cc=yuchao0@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-EROFS Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-erofs/0 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/ https://lore.kernel.org/linux-erofs \ linux-erofs@lists.ozlabs.org linux-erofs@ozlabs.org public-inbox-index linux-erofs Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.ozlabs.lists.linux-erofs AGPL code for this site: git clone https://public-inbox.org/public-inbox.git