Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -2
+6 -2
fs/squashfs/xattr.c
··· 145 145 type = le16_to_cpu(entry.type); 146 146 prefix = type & SQUASHFS_XATTR_PREFIX_MASK; 147 147 148 - err = squashfs_read_metadata(sb, target, &start, &offset, 149 - name_size); 148 + if (prefix == name_index && name_size == name_len) 149 + err = squashfs_read_metadata(sb, target, &start, 150 + &offset, name_size); 151 + else 152 + err = squashfs_read_metadata(sb, NULL, &start, 153 + &offset, name_size); 150 154 if (err < 0) 151 155 goto failed; 152 156