]> git.baikalelectronics.ru Git - kernel.git/commit
block: don't create too many partitions
authorMing Lei <ming.lei@redhat.com>
Sat, 27 Mar 2021 07:13:09 +0000 (15:13 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 27 Mar 2021 15:22:18 +0000 (09:22 -0600)
commitd0183af0bb7cd94ef40ab83c8f2bfce5a6a9f677
tree676ffbe3e79759503f9d360c6388483a14313086
parentbea14c237d2b2a4d74dcef5dcf69a82d124f695b
block: don't create too many partitions

Commit 02c200262632 ("block: use an xarray for disk->part_tbl") drops the
check on max supported number of partitionsr, and allows partition with
bigger partition numbers to be added. However, ->bd_partno is defined as
u8, so partition index of xarray table may not match with ->bd_partno.
Then delete_partition() may delete one unmatched partition, and caused
use-after-free.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reported-by: syzbot+8fede7e30c7cee0de139@syzkaller.appspotmail.com
Fixes: 02c200262632 ("block: use an xarray for disk->part_tbl")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/partitions/core.c