Skip to content

Commit 05c2d1f

Browse files
committed
Merge tag 'block-6.13-20250111' of git://git.kernel.dk/linux
Pull block fix from Jens Axboe: "A single fix for a use-after-free in the BFQ IO scheduler" * tag 'block-6.13-20250111' of git://git.kernel.dk/linux: block, bfq: fix waker_bfqq UAF after bfq_split_bfqq()
2 parents 52a5a22 + fcede1f commit 05c2d1f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

block/bfq-iosched.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6844,16 +6844,24 @@ static struct bfq_queue *bfq_waker_bfqq(struct bfq_queue *bfqq)
68446844
if (new_bfqq == waker_bfqq) {
68456845
/*
68466846
* If waker_bfqq is in the merge chain, and current
6847-
* is the only procress.
6847+
* is the only process, waker_bfqq can be freed.
68486848
*/
68496849
if (bfqq_process_refs(waker_bfqq) == 1)
68506850
return NULL;
6851-
break;
6851+
6852+
return waker_bfqq;
68526853
}
68536854

68546855
new_bfqq = new_bfqq->new_bfqq;
68556856
}
68566857

6858+
/*
6859+
* If waker_bfqq is not in the merge chain, and it's procress reference
6860+
* is 0, waker_bfqq can be freed.
6861+
*/
6862+
if (bfqq_process_refs(waker_bfqq) == 0)
6863+
return NULL;
6864+
68576865
return waker_bfqq;
68586866
}
68596867

0 commit comments

Comments
 (0)