Skip to content

Commit

Permalink
blk: add an upper sanity check on partition adding
Browse files Browse the repository at this point in the history
65536 should be ludicrous anyway but without it we overflow the
memory computation doing the allocation and badness occurs.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Alan Cox authored and axboe committed Sep 18, 2012
1 parent 97651ea commit 2bd6efa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 2bd6efa

Please sign in to comment.