提交 2bd6efad 编写于 作者: A Alan Cox 提交者: Jens Axboe

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: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 97651ea6
...@@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user ...@@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
sizeof(long long) > sizeof(long)) { sizeof(long long) > sizeof(long)) {
long pstart = start, plength = length; long pstart = start, plength = length;
if (pstart != start || plength != length if (pstart != start || plength != length
|| pstart < 0 || plength < 0) || pstart < 0 || plength < 0 || partno > 65535)
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册