]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix locking in bdev_del_partition
authorChristoph Hellwig <hch@lst.de>
Tue, 1 Sep 2020 09:59:41 +0000 (11:59 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 1 Sep 2020 14:35:35 +0000 (08:35 -0600)
commit3e441c5626638afc40eb2333b62c452e21fa5f3c
tree7e141849aad3fc830215030bb9cf0cbe081a80f1
parent2da53cc4b9ff0b03faf8ad984a7c5492f5cf3ec1
block: fix locking in bdev_del_partition

We need to hold the whole device bd_mutex to protect against
other thread concurrently deleting out partition before we get
to it, and thus causing a use after free.

Fixes: bc74e398cfe3 ("block: pass a hd_struct to delete_partition")
Reported-by: syzbot+6448f3c229bc52b82f69@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/partitions/core.c