Permalink
Browse files

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 <alan@linux.intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information...
1 parent 97651ea commit 2bd6efad25d7c1950008e2ab4e2d6796001919fc Alan Cox committed with axboe Sep 17, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 block/ioctl.c
View
@@ -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;
}

0 comments on commit 2bd6efa

Please sign in to comment.