diff options
| author | Josef Bacik <josef@toxicpanda.com> | 2026-10-28 10:41:07 -0600 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-10-29 07:15:46 -0600 |
| commit | cebb1c2331c2af1b7f1c822ac672a7f77b54bd90 (patch) | |
| tree | 05c8c1c307dae6c9825fca7b331810fa59d1628b /tools/lib/python/kdoc/python_version.py | |
| parent | 045cbfc369f5929ed473f7c200dc2e8146569ce5 (diff) | |
block: fix use-after-free of the disk in sync_bdevs()
sync_bdevs() holds a reference to the bdev inode while it takes
bd_disk->open_mutex. For a partition the inode doesn't keep the gendisk
alive, the device reference does: part_release() drops the disk as soon
as the last reference to the partition device is gone. A sync(2) racing
with the last close of a partition of an already deleted disk locks a
freed open_mutex.
Take a device reference before touching the disk, like
blkdev_get_no_open() does, and skip the bdev if it's on its way out.
Fixes: a8698707a183 ("block: move bd_mutex to struct gendisk")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261028164415.1262013-5-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
