linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Hebb <tommyhebb@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: stable@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>,
	Hin-Tak Leung <htl10@users.sourceforge.net>,
	Sergei Antonov <saproj@gmail.com>,
	Anton Altaparmakov <anton@tuxera.com>,
	Fabian Frederick <fabf@skynet.be>,
	Christian Kujau <lists@nerdbynature.de>
Subject: [PATCH] hfsplus: add missing osx prefix to FinderInfo attribute check
Date: Tue, 31 Mar 2015 23:41:56 -0400	[thread overview]
Message-ID: <551B6904.50405@gmail.com> (raw)

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: stable@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Sergei Antonov <saproj@gmail.com>
Cc: Anton Altaparmakov <anton@tuxera.com>
Cc: Fabian Frederick <fabf@skynet.be>
Cc: Christian Kujau <lists@nerdbynature.de>
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
---
 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


             reply	other threads:[~2015-04-01  3:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  3:41 Thomas Hebb [this message]
2015-04-01 16:38 ` [PATCH] hfsplus: add missing osx prefix to FinderInfo attribute check Viacheslav Dubeyko
2015-04-02 23:57   ` Thomas Hebb
2015-04-03  0:28     ` Viacheslav Dubeyko
2015-04-02 23:41 ` Sergei Antonov
2015-04-03  1:33   ` Viacheslav Dubeyko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=551B6904.50405@gmail.com \
    --to=tommyhebb@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anton@tuxera.com \
    --cc=fabf@skynet.be \
    --cc=htl10@users.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lists@nerdbynature.de \
    --cc=saproj@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).