aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/super.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-07-10 11:58:04 -0400
committerJan Kara <jack@suse.cz>2012-07-10 12:02:17 -0400
commit57b9655d01ef057a523e810d29c37ac09b80eead (patch)
tree2574c27c92170f6e580ac9d59c5719bffae994d1 /fs/udf/super.c
parent44f4f729e7a143b08bd63c33cb78b3181d9f4716 (diff)
udf: Improve table length check to avoid possible overflow
When a partition table length is corrupted to be close to 1 << 32, the check for its length may overflow on 32-bit systems and we will think the length is valid. Later on the kernel can crash trying to read beyond end of buffer. Fix the check to avoid possible overflow. CC: stable@vger.kernel.org Reported-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r--fs/udf/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 8a7583867811..dcbf98722afc 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1340,7 +1340,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1340 BUG_ON(ident != TAG_IDENT_LVD); 1340 BUG_ON(ident != TAG_IDENT_LVD);
1341 lvd = (struct logicalVolDesc *)bh->b_data; 1341 lvd = (struct logicalVolDesc *)bh->b_data;
1342 table_len = le32_to_cpu(lvd->mapTableLength); 1342 table_len = le32_to_cpu(lvd->mapTableLength);
1343 if (sizeof(*lvd) + table_len > sb->s_blocksize) { 1343 if (table_len > sb->s_blocksize - sizeof(*lvd)) {
1344 udf_err(sb, "error loading logical volume descriptor: " 1344 udf_err(sb, "error loading logical volume descriptor: "
1345 "Partition table too long (%u > %lu)\n", table_len, 1345 "Partition table too long (%u > %lu)\n", table_len,
1346 sb->s_blocksize - sizeof(*lvd)); 1346 sb->s_blocksize - sizeof(*lvd));