aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox2012-09-17 05:47:13 -0500
committerJens Axboe2012-09-18 04:56:29 -0500
commit2bd6efad25d7c1950008e2ab4e2d6796001919fc (patch)
tree408c87e0808e9b4ad4c8f9d95063c89d50350545 /block/ioctl.c
parent97651ea687d3b6a214c32b49f79523db709fba18 (diff)
downloadkernel-common-2bd6efad25d7c1950008e2ab4e2d6796001919fc.tar.gz
kernel-common-2bd6efad25d7c1950008e2ab4e2d6796001919fc.tar.xz
kernel-common-2bd6efad25d7c1950008e2ab4e2d6796001919fc.zip
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>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index 4476e0e85d1..4a85096f541 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
41 sizeof(long long) > sizeof(long)) { 41 sizeof(long long) > sizeof(long)) {
42 long pstart = start, plength = length; 42 long pstart = start, plength = length;
43 if (pstart != start || plength != length 43 if (pstart != start || plength != length
44 || pstart < 0 || plength < 0) 44 || pstart < 0 || plength < 0 || partno > 65535)
45 return -EINVAL; 45 return -EINVAL;
46 } 46 }
47 47