This is a note to let you know that I've just added the patch titled

    fs/partitions/efi.c: corrupted GUID partition tables can cause kernel oops

to the 2.6.39-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     
fs-partitions-efi.c-corrupted-guid-partition-tables-can-cause-kernel-oops.patch
and it can be found in the queue-2.6.39 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <sta...@kernel.org> know about it.


>From 3eb8e74ec72736b9b9d728bad30484ec89c91dde Mon Sep 17 00:00:00 2001
From: Timo Warns <wa...@pre-sense.de>
Date: Thu, 26 May 2011 16:25:57 -0700
Subject: fs/partitions/efi.c: corrupted GUID partition tables can cause kernel 
oops

From: Timo Warns <wa...@pre-sense.de>

commit 3eb8e74ec72736b9b9d728bad30484ec89c91dde upstream.

The kernel automatically evaluates partition tables of storage devices.
The code for evaluating GUID partitions (in fs/partitions/efi.c) contains
a bug that causes a kernel oops on certain corrupted GUID partition
tables.

This bug has security impacts, because it allows, for example, to
prepare a storage device that crashes a kernel subsystem upon connecting
the device (e.g., a "USB Stick of (Partial) Death").

        crc = efi_crc32((const unsigned char *) (*gpt), 
le32_to_cpu((*gpt)->header_size));

computes a CRC32 checksum over gpt covering (*gpt)->header_size bytes.
There is no validation of (*gpt)->header_size before the efi_crc32 call.

A corrupted partition table may have large values for (*gpt)->header_size.
 In this case, the CRC32 computation access memory beyond the memory
allocated for gpt, which may cause a kernel heap overflow.

Validate value of GUID partition table header size.

[a...@linux-foundation.org: fix layout and indenting]
Signed-off-by: Timo Warns <wa...@pre-sense.de>
Cc: Matt Domsch <matt_dom...@dell.com>
Cc: Eugene Teo <eugene...@kernel.sg>
Cc: Dave Jones <da...@codemonkey.org.uk>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Cc: Moritz Muehlenhoff <j...@debian.org>
Signed-off-by: Greg Kroah-Hartman <gre...@suse.de>

---
 fs/partitions/efi.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -310,6 +310,15 @@ static int is_gpt_valid(struct parsed_pa
                goto fail;
        }
 
+       /* Check the GUID Partition Table header size */
+       if (le32_to_cpu((*gpt)->header_size) >
+                       bdev_logical_block_size(state->bdev)) {
+               pr_debug("GUID Partition Table Header size is wrong: %u > %u\n",
+                       le32_to_cpu((*gpt)->header_size),
+                       bdev_logical_block_size(state->bdev));
+               goto fail;
+       }
+
        /* Check the GUID Partition Table CRC */
        origcrc = le32_to_cpu((*gpt)->header_crc32);
        (*gpt)->header_crc32 = 0;


Patches currently in stable-queue which might be from wa...@pre-sense.de are

queue-2.6.39/fs-partitions-efi.c-corrupted-guid-partition-tables-can-cause-kernel-oops.patch

_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to