]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
genhd: check for int overflow in disk_expand_part_tbl()
authorJens Axboe <axboe@fb.com>
Wed, 19 Nov 2014 20:06:22 +0000 (13:06 -0700)
committerZefan Li <lizefan@huawei.com>
Tue, 14 Apr 2015 09:33:42 +0000 (17:33 +0800)
commit45fdc587f1615d7fc4a318650c2bedc3c590f428
tree9732ae38c1bdc0143ed9f7dcc149930f5567e5b6
parent47d90ff8a06e6b98612c0974f759d6f4549e716e
genhd: check for int overflow in disk_expand_part_tbl()

commit 5fabcb4c33fe11c7e3afdf805fde26c1a54d0953 upstream.

We can get here from blkdev_ioctl() -> blkpg_ioctl() -> add_partition()
with a user passed in partno value. If we pass in 0x7fffffff, the
new target in disk_expand_part_tbl() overflows the 'int' and we
access beyond the end of ptbl->part[] and even write to it when we
do the rcu_assign_pointer() to assign the new partition.

Reported-by: David Ramos <daramos@stanford.edu>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
block/genhd.c