From: Alan Cox Date: Mon, 17 Sep 2012 10:47:13 +0000 (+0100) Subject: blk: add an upper sanity check on partition adding X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2bd6efad25d7c1950008e2ab4e2d6796001919fc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git blk: add an upper sanity check on partition adding 65536 should be ludicrous anyway but without it we overflow the memory computation doing the allocation and badness occurs. Signed-off-by: Alan Cox Signed-off-by: Jens Axboe --- diff --git a/block/ioctl.c b/block/ioctl.c index 4476e0e85d16..4a85096f5410 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user sizeof(long long) > sizeof(long)) { long pstart = start, plength = length; if (pstart != start || plength != length - || pstart < 0 || plength < 0) + || pstart < 0 || plength < 0 || partno > 65535) return -EINVAL; }