]> git.itanic.dy.fi Git - linux-stable/commit
block: fix use-after-free in disk_part_iter_next
authorMing Lei <ming.lei@redhat.com>
Mon, 21 Dec 2020 04:33:35 +0000 (12:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 12:55:14 +0000 (13:55 +0100)
commita09652089d496a4ecb925e2cb95a6523f22ae538
tree0ca909bfb5aeeadc09c61482146a41777ad7796f
parentd5453054e2da78cfaf1ec9d18e906702db852b2c
block: fix use-after-free in disk_part_iter_next

commit aebf5db917055b38f4945ed6d621d9f07a44ff30 upstream.

Make sure that bdgrab() is done on the 'block_device' instance before
referring to it for avoiding use-after-free.

Cc: <stable@vger.kernel.org>
Reported-by: syzbot+825f0f9657d4e528046e@syzkaller.appspotmail.com
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/genhd.c