Commit 6f048645 authored by Phillip Lougher's avatar Phillip Lougher

Squashfs: add sanity checks to xattr reading at mount time

These checks add sanity checking of the mount-time xattr structures.
Signed-off-by: default avatarPhillip Lougher <phillip@lougher.demon.co.uk>
parent 76e002f7
...@@ -76,6 +76,17 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 start, ...@@ -76,6 +76,17 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 start,
*xattr_table_start = le64_to_cpu(id_table->xattr_table_start); *xattr_table_start = le64_to_cpu(id_table->xattr_table_start);
*xattr_ids = le32_to_cpu(id_table->xattr_ids); *xattr_ids = le32_to_cpu(id_table->xattr_ids);
kfree(id_table); kfree(id_table);
/* Sanity check values */
/* there is always at least one xattr id */
if (*xattr_ids == 0)
return ERR_PTR(-EINVAL);
/* xattr_table should be less than start */
if (*xattr_table_start >= start)
return ERR_PTR(-EINVAL);
len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids); len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids);
TRACE("In read_xattr_index_table, length %d\n", len); TRACE("In read_xattr_index_table, length %d\n", len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment