From: Gao Xiang <hsiangkao@aol.com> To: Chao Yu <yuchao0@huawei.com>, linux-erofs@lists.ozlabs.org Cc: LKML <linux-kernel@vger.kernel.org>, David Michael <fedora.dm0@gmail.com>, Miao Xie <miaoxie@huawei.com>, Fang Wei <fangwei1@huawei.com>, Wang Li <wangli74@huawei.com>, Gao Xiang <gaoxiang25@huawei.com>, stable@vger.kernel.org Subject: [PATCH] erofs: zero out when listxattr is called with no xattr Date: Sun, 1 Dec 2019 16:40:40 +0800 [thread overview] 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
WARNING: multiple messages have this Message-ID (diff)
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 [thread overview] 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 other threads:[~2019-12-01 8:41 UTC|newest] Thread overview: 7+ 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 [this message] 2019-12-01 8:40 ` [PATCH] erofs: zero out when listxattr is called with no xattr 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
Reply instructions: You may reply publicly 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=hsiangkao@aol.com \ --cc=fangwei1@huawei.com \ --cc=fedora.dm0@gmail.com \ --cc=gaoxiang25@huawei.com \ --cc=linux-erofs@lists.ozlabs.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.