From bb8a0f34727a4c0524792fecf9d02c5135f6e8c3 Mon Sep 17 00:00:00 2001 From: Sandeep Dhavale Date: Tue, 20 Aug 2024 14:01:23 -0700 Subject: [PATCH] erofs-utils: lib: actually skip the unidentified xattrs parse_one_xattr() will return null if it detects unidentified xattr. In such cases we need to skip this xattr which was our intention than try to add it in erofs_xattr_add() which results in null pointer dereference. Fixes: 3037f8958f3b ("erofs-utils: skip all unidentified xattrs from local paths") Signed-off-by: Sandeep Dhavale Link: https://lore.kernel.org/r/20240820210123.2684886-2-dhavale@google.com Signed-off-by: Gao Xiang --- lib/xattr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/xattr.c b/lib/xattr.c index 651657f..9f31f2d 100644 --- a/lib/xattr.c +++ b/lib/xattr.c @@ -448,6 +448,9 @@ static int read_xattrs_from_file(const char *path, mode_t mode, ret = PTR_ERR(item); goto err; } + /* skip unidentified xattrs */ + if (!item) + continue; ret = erofs_xattr_add(ixattrs, item); if (ret < 0) -- 2.34.1