summaryrefslogtreecommitdiff
path: root/fs/squashfs
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2010-05-23 08:27:42 +0100
committerPhillip Lougher <phillip@lougher.demon.co.uk>2010-05-23 08:27:42 +0100
commit5c80f5aa409b211ab193c56fb6b77d73b61966e5 (patch)
tree8559d669666b1174067f29294015164251d2088b /fs/squashfs
parentf6db25a87643fa6108e211da0397423593ca36fe (diff)
squashfs: fix name reading in squashfs_xattr_get
Only read potentially matching names into the target buffer, all obviously non matching names don't need to be read into the target buffer. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Diffstat (limited to 'fs/squashfs')
-rw-r--r--fs/squashfs/xattr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index 14a2feef09b9..c7655e8b31cd 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -145,8 +145,12 @@ static int squashfs_xattr_get(struct inode *inode, int name_index,
type = le16_to_cpu(entry.type);
prefix = type & SQUASHFS_XATTR_PREFIX_MASK;
- err = squashfs_read_metadata(sb, target, &start, &offset,
- name_size);
+ if (prefix == name_index && name_size == name_len)
+ err = squashfs_read_metadata(sb, target, &start,
+ &offset, name_size);
+ else
+ err = squashfs_read_metadata(sb, NULL, &start,
+ &offset, name_size);
if (err < 0)
goto failed;