erofs: zero out when listxattr is called with no xattr
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 erofs: zero out when listxattr is called with no xattr
From: Gao Xiang <[email protected]>
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
--- fs/erofs/xattr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/erofs/xattr.c +2 -0
@@ -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;
Signature · 1 line
2.20.1
Sasha Levin
maintainerHi,
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag,
fixing commit: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule").
The bot has tested the following trees: v5.4.1, v5.3.14, v4.19.87.
v5.4.1: Build OK!
v5.3.14: Failed to apply! Possible dependencies:
Unable to calculate
v4.19.87: Failed to apply! Possible dependencies:
Unable to calculate
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks, Sasha
Hi Sasha,
Quoted 7 lines · Sasha Levin
Hi,
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag,
fixing commit:cadf1ccf1b00("staging: erofs: add error handling for xattr submodule").
Quoted 8 lines
The bot has tested the following trees: v5.4.1, v5.3.14, v4.19.87.
v5.4.1: Build OK!
v5.3.14: Failed to apply! Possible dependencies:
Unable to calculatev4.19.87: Failed to apply! Possible dependencies:
Unable to calculate
Because of file movement, I'll backport manually then.
Thanks,
Gao Xiang
Quoted 9 lines
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks, Sasha
Quoted 10 lines · Gao Xiang
From: Gao Xiang <[email protected]>
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
-ENODATAby mistake for inodes without xattr. That breaks listxattr return value convention and it can cause copy up failure when used with overlayfs.
Quoted 6 lines
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 <[email protected]> # 4.19+Signed-off-by Gao Xiang <[email protected]>
Thanks,