mac: validate mac_partition is within sector
authorKees Cook <keescook@chromium.org>
Fri, 20 Nov 2015 01:18:54 +0000 (17:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Mar 2016 23:06:21 +0000 (15:06 -0800)
commit2a27f61bd411e564eb4651c18d225f6e9e1de534
tree16dab0c694456912e3a6545d63dd756fe420d2ae
parente3dda035201bd6299d95414c7d9943f721b7be87
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/partitions/mac.c