diff options
| author | Yuho Choi <dbgh9129@gmail.com> | 2026-05-25 12:25:31 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-05-26 11:01:55 -0600 |
| commit | 7817bdf8ee049496fa93f68cc257903f079c0180 (patch) | |
| tree | 2dc33ab794c07e25dab2387425b2634ec91ccc52 /include/linux/timerqueue_types.h | |
| parent | a148d0a5af1ab60253994047403f9eb41ef709a4 (diff) | |
mtip32xx: fix use-after-free on service thread failure
If service thread creation fails after device_add_disk() succeeds,
mtip_block_initialize() calls del_gendisk() and then falls through to
put_disk(). Since mtip32xx uses .free_disk to free struct driver_data,
put_disk() can release dd on the added-disk path.
The same unwind then continues to use dd for blk_mq_free_tag_set() and
mtip_hw_exit(), and mtip_pci_probe() can later free dd again. This can
cause a use-after-free and double free.
Track whether the disk was added in the current initialization call.
For the post-add service-thread failure path, remove the disk, release
the local hardware resources, and return without dropping the final disk
reference. The probe error path can then finish its cleanup and call
put_disk() after it is done using dd. Keep the pre-add path using
put_disk() before blk_mq_free_tag_set(), and clear dd->disk so the outer
probe cleanup frees dd directly.
Fixes: e8b58ef09e84 ("mtip32xx: fix device removal")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Link: https://patch.msgid.link/20260525162531.1406677-1-dbgh9129@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/timerqueue_types.h')
0 files changed, 0 insertions, 0 deletions
