[lkml]   [2019]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.4 110/177] erofs: zero out when listxattr is called with no xattr
From: Gao Xiang <>

commit 926d1650176448d7684b991fbe1a5b1a8289e97c 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.

Fixes: cadf1ccf1b00 ("staging: erofs: add error handling for xattr submodule")
Cc: <> # 4.19+
Reviewed-by: Chao Yu <>
Signed-off-by: Gao Xiang <>
Signed-off-by: Greg Kroah-Hartman <>

fs/erofs/xattr.c | 2 ++
1 file changed, 2 insertions(+)

--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -649,6 +649,8 @@ ssize_t erofs_listxattr(struct dentry *d
struct listxattr_iter it;

ret = init_inode_xattrs(d_inode(dentry));
+ if (ret == -ENOATTR)
+ return 0;
if (ret)
return ret;

 \ /
  Last update: 2019-12-16 19:26    [W:0.358 / U:3.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site