Skip to contentSkip to conversation

erofs: zero out when listxattr is called with no xattr

PATCH In review Gao Xiang 4 participants 4 messages Dec 1, 2019 – Dec 4, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Gao Xiang

author
#1 lore raw

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

Fixes cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
Cc <[email protected]> # 4.19+
---
 fs/erofs/xattr.c | 2 ++
 1 file changed, 2 insertions(+)
fs/erofs/xattr.c +2 -0
index a13a78725c57..b766c3ee5fa8 100644
@@ -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
maintainer
#2 lore raw

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").

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
#3 lore raw

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 calculate

v4.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
Reviewed-by on v1 1/1
#4 lore raw
In reply to Gao Xiang
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 -ENODATA by 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+

Thanks,