mac: validate mac_partition is within sector
authorKees Cook <keescook@chromium.org>
Fri, 20 Nov 2015 01:18:54 +0000 (17:18 -0800)
committerZefan Li <lizefan@huawei.com>
Wed, 26 Oct 2016 15:15:32 +0000 (23:15 +0800)
commit34a906cd9f6445d9510841667eff0d980279ebf3
tree0527a814c89b7d52ac90ad6b3516595d3e551b78
parent1483b3cca5278889bfe4e7bfced14f1c3978f8be
mac: validate mac_partition is within sector

commit 02e2a5bfebe99edcf9d694575a75032d53fe1b73 upstream.

If md->signature == MAC_DRIVER_MAGIC and md->block_size == 1023, a single
512 byte sector would be read (secsize / 512). However the partition
structure would be located past the end of the buffer (secsize % 512).

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
block/partitions/mac.c