Skip to content

Commit

Permalink
squashfs: fix name reading in squashfs_xattr_get
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Phillip Lougher committed May 23, 2010
1 parent f6db25a commit 5c80f5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/squashfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5c80f5a

Please sign in to comment.