1
0
Fork 0
remarkable-linux/block/partitions
Alden Tondettar 0fc89de6ee partitions/efi: Fix integer overflow in GPT size calculation
[ Upstream commit c5082b70ad ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-08 10:26:06 +02:00
..
Kconfig block: change config option name for cmdline partition parsing 2013-09-30 14:31:02 -07:00
Makefile block: support embedded device command line partition 2013-09-11 15:56:57 -07:00
acorn.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
acorn.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
aix.c partitions: aix.c: off by one bug 2014-08-05 13:13:24 -06:00
aix.h partitions: add aix lvm partition support files 2013-07-09 10:33:28 -07:00
amiga.c block/partitions/amiga.c: replace nolevel printk by pr_err 2014-07-01 10:40:02 -06:00
amiga.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
atari.c block: atari: Return early for unsupported sector size 2016-07-13 09:31:44 -07:00
atari.h block: Use macros from compiler.h instead of __attribute__((...)) 2014-02-18 12:20:01 -08:00
check.c block: Remove annoying "unknown partition table" message 2015-01-22 08:03:52 -07:00
check.h block/partitions: optimize memory allocation in check_partition() 2013-02-27 19:10:21 -08:00
cmdline.c block: change config option name for cmdline partition parsing 2013-09-30 14:31:02 -07:00
cmdline.h block: support embedded device command line partition 2013-09-11 15:56:57 -07:00
efi.c partitions/efi: Fix integer overflow in GPT size calculation 2017-10-08 10:26:06 +02:00
efi.h block: Use macros from compiler.h instead of __attribute__((...)) 2014-02-18 12:20:01 -08:00
ibm.c s390/partitions: make partition detection independent from DASD ioctls 2012-09-26 15:45:05 +02:00
ibm.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
karma.c block: Use macros from compiler.h instead of __attribute__((...)) 2014-02-18 12:20:01 -08:00
karma.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ldm.c block/partitions/ldm.c: use generic UUID library 2016-05-20 17:58:30 -07:00
ldm.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
mac.c mac: validate mac_partition is within sector 2015-11-20 08:49:28 -07:00
mac.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
msdos.c partitions/msdos: FreeBSD UFS2 file systems are not recognized 2017-06-17 06:41:49 +02:00
msdos.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
osf.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
osf.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sgi.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sgi.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sun.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sun.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sysv68.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sysv68.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ultrix.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ultrix.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00