summaryrefslogtreecommitdiffstats
path: root/fs/erofs
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2019-12-01 16:01:09 +0800
committerGao Xiang <gaoxiang25@huawei.com>2019-12-04 21:15:04 +0800
commit926d1650176448d7684b991fbe1a5b1a8289e97c (patch)
treed32aa6dc1ce20ac6950b5b52b409a7098c9bc54d /fs/erofs
parent219d54332a09e8d8741c1e1982f5eae56099de85 (diff)
downloadlinux-926d1650176448d7684b991fbe1a5b1a8289e97c.tar.gz
linux-926d1650176448d7684b991fbe1a5b1a8289e97c.tar.bz2
linux-926d1650176448d7684b991fbe1a5b1a8289e97c.zip
erofs: zero out when listxattr is called with no xattr
As David reported [1], ENODATA returns when attempting to modify files by using EROFS as an 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 Link: https://lore.kernel.org/r/20191201084040.29275-1-hsiangkao@aol.com Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule") Cc: <stable@vger.kernel.org> # 4.19+ Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Diffstat (limited to 'fs/erofs')
-rw-r--r--fs/erofs/xattr.c2
1 files changed, 2 insertions, 0 deletions
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;