]> git.baikalelectronics.ru Git - kernel.git/commit
erofs: zero out when listxattr is called with no xattr
authorGao Xiang <gaoxiang25@huawei.com>
Sun, 1 Dec 2019 08:01:09 +0000 (16:01 +0800)
committerGao Xiang <gaoxiang25@huawei.com>
Wed, 4 Dec 2019 13:15:04 +0000 (21:15 +0800)
commit8cd9242d0e3066469fa952fc3692da3a927a63db
treed32aa6dc1ce20ac6950b5b52b409a7098c9bc54d
parent3f43e68c1b0e9fcf5f42fecbc02b606b6ad6a58d
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: 6c4a54e6b992 ("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>
fs/erofs/xattr.c