aboutsummaryrefslogtreecommitdiffstats
path: root/fs/squashfs/xattr_id.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2011-05-23 22:20:27 -0400
committerPhillip Lougher <phillip@lougher.demon.co.uk>2011-05-25 13:21:31 -0400
commit6f04864515365e135adc9f1cee4ac1251bb0ed35 (patch)
treef5c6181d52217b66606cc878536b2225c692f25a /fs/squashfs/xattr_id.c
parent76e002f755b61aa79228f4e751bbca8674aba0f6 (diff)
Squashfs: add sanity checks to xattr reading at mount time
These checks add sanity checking of the mount-time xattr structures. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Diffstat (limited to 'fs/squashfs/xattr_id.c')
-rw-r--r--fs/squashfs/xattr_id.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/squashfs/xattr_id.c b/fs/squashfs/xattr_id.c
index 51a7bd0cc44..f60fb3cce18 100644
--- a/fs/squashfs/xattr_id.c
+++ b/fs/squashfs/xattr_id.c
@@ -76,6 +76,17 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 start,
76 *xattr_table_start = le64_to_cpu(id_table->xattr_table_start); 76 *xattr_table_start = le64_to_cpu(id_table->xattr_table_start);
77 *xattr_ids = le32_to_cpu(id_table->xattr_ids); 77 *xattr_ids = le32_to_cpu(id_table->xattr_ids);
78 kfree(id_table); 78 kfree(id_table);
79
80 /* Sanity check values */
81
82 /* there is always at least one xattr id */
83 if (*xattr_ids == 0)
84 return ERR_PTR(-EINVAL);
85
86 /* xattr_table should be less than start */
87 if (*xattr_table_start >= start)
88 return ERR_PTR(-EINVAL);
89
79 len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids); 90 len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids);
80 91
81 TRACE("In read_xattr_index_table, length %d\n", len); 92 TRACE("In read_xattr_index_table, length %d\n", len);