Commit b56d00ac authored by Gao Xiang's avatar Gao Xiang Committed by Greg Kroah-Hartman

erofs: zero out when listxattr is called with no xattr

commit 926d1650 upstream.

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: cadf1ccf ("staging: erofs: add error handling for xattr submodule")
Cc: <stable@vger.kernel.org> # 4.19+
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9678821
...@@ -638,6 +638,8 @@ ssize_t erofs_listxattr(struct dentry *dentry, ...@@ -638,6 +638,8 @@ ssize_t erofs_listxattr(struct dentry *dentry,
struct listxattr_iter it; struct listxattr_iter it;
ret = init_inode_xattrs(d_inode(dentry)); ret = init_inode_xattrs(d_inode(dentry));
if (ret == -ENOATTR)
return 0;
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment