https://bugzilla.redhat.com/show_bug.cgi?id=843141
commit 57b9655d01ef057a523e810d29c37ac09b80eead Author: Jan Kara jack@suse.cz Date: Tue Jul 10 17:58:04 2012 +0200
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
Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com --- fs/udf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c index f4a1800..77d83fe 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1036,7 +1036,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_a lvd = (struct logicalVolDesc *)bh->b_data;
table_len = le32_to_cpu(lvd->mapTableLength); - if (sizeof(*lvd) + table_len > sb->s_blocksize) { + if (table_len > sb->s_blocksize - sizeof(*lvd)) { udf_error(sb, __FUNCTION__, "error loading logical volume descriptor: " "Partition table too long (%u > %lu)\n", table_len,
crash-catcher@lists.fedorahosted.org