]> git.baikalelectronics.ru Git - kernel.git/commit
partitions/efi: Fix integer overflow in GPT size calculation
authorAlden Tondettar <alden.tondettar@gmail.com>
Sun, 15 Jan 2017 22:31:56 +0000 (15:31 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 17 Jan 2017 16:02:31 +0000 (09:02 -0700)
commit90d8c6830ffe7ddf70c4811b082f3ed774e32833
tree2cc8bab578b10b57837d87d9ec274aa19af7b2a3
parent8f431c0c37db610259f240c6a2cc61f384a30511
partitions/efi: Fix integer overflow in GPT size calculation

If a GUID Partition Table claims to have more than 2**25 entries, the
calculation of the partition table size in alloc_read_gpt_entries() will
overflow a 32-bit integer and not enough space will be allocated for the
table.

Nothing seems to get written out of bounds, but later efi_partition() will
read up to 32768 bytes from a 128 byte buffer, possibly OOPSing or exposing
information to /proc/partitions and uevents.

The problem exists on both 64-bit and 32-bit platforms.

Fix the overflow and also print a meaningful debug message if the table
size is too large.

Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/partitions/efi.c