Skip to content

Commit 884f0e8

Browse files
Li Jinlinaxboe
authored andcommitted
blk-throttle: fix UAF by deleteing timer in blk_throtl_exit()
The pending timer has been set up in blk_throtl_init(). However, the timer is not deleted in blk_throtl_exit(). This means that the timer handler may still be running after freeing the timer, which would result in a use-after-free. Fix by calling del_timer_sync() to delete the timer in blk_throtl_exit(). Signed-off-by: Li Jinlin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent dfbb340 commit 884f0e8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/blk-throttle.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,6 +2458,7 @@ int blk_throtl_init(struct request_queue *q)
24582458
void blk_throtl_exit(struct request_queue *q)
24592459
{
24602460
BUG_ON(!q->td);
2461+
del_timer_sync(&q->td->service_queue.pending_timer);
24612462
throtl_shutdown_wq(q);
24622463
blkcg_deactivate_policy(q, &blkcg_policy_throtl);
24632464
free_percpu(q->td->latency_buckets[READ]);

0 commit comments

Comments
 (0)