Skip to content
Commit 53cfdc10 authored by Jiufei Xue's avatar Jiufei Xue Committed by Jens Axboe
Browse files

blk-throttle: fix null pointer dereference while throttling writeback IOs



A null pointer dereference can occur when blkcg is removed manually
with writeback IOs inflight. This is caused by the following case:

Writeback kworker submit the bio and set bio->bi_cg_private to tg
in blk_throtl_assoc_bio.
Then we remove the block cgroup manually, the blkg and tg would be
freed if there is no request inflight.
When the submitted bio come back, blk_throtl_bio_endio() fetch the tg
which was already freed.

Fix this by increasing the refcount of blkg in funcion
blk_throtl_assoc_bio() so that the blkg will not be freed until the
bio_endio called.

Reviewed-by: default avatarShaohua Li <shli@fb.com>
Signed-off-by: default avatarJiufei Xue <jiufei.xjf@alibaba-inc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 58a9edce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment