By the time we reach strcmp_xattr_finder_info(), hfsplus_osx_getxattr()
has already prefixed the user-provided xattr name with "osx.", so the
existing check for the special FinderInfo attribute will always fail,
and ENODATA will be returned to userspace.

Since hfsplus_listxattr() reports the FinderInfo attribute, this
behavior causes certain userspace utilities (e.g. patch) to fail, since
the kernel lists an attribute that doesn't exist.

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Cc: Hin-Tak Leung <[email protected]>
Cc: Sergei Antonov <[email protected]>
Cc: Anton Altaparmakov <[email protected]>
Cc: Fabian Frederick <[email protected]>
Cc: Christian Kujau <[email protected]>
Signed-off-by: Thomas Hebb <[email protected]>
---
 fs/hfsplus/xattr.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index d98094a..da0664e 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -28,8 +28,16 @@ const struct xattr_handler *hfsplus_xattr_handlers[] = {
  static int strcmp_xattr_finder_info(const char *name)
 {
+       int err = 0;
+
        if (name) {
-               return strncmp(name, HFSPLUS_XATTR_FINDER_INFO_NAME,
+               err = strncmp(name, XATTR_MAC_OSX_PREFIX,
+                               XATTR_MAC_OSX_PREFIX_LEN);
+               if (err)
+                       return err;
+
+               return strncmp(name + XATTR_MAC_OSX_PREFIX_LEN,
+                               HFSPLUS_XATTR_FINDER_INFO_NAME,
                                sizeof(HFSPLUS_XATTR_FINDER_INFO_NAME));
        }
        return -1;
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to