diff options
| author | Jackie Liu <liuyun01@kylinos.cn> | 2026-03-31 11:50:54 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-03-31 22:55:41 +0300 |
| commit | 23308af722fefed00af5f238024c11710938fba3 (patch) | |
| tree | 02c37b066a876c7e1a3827923598d229cea6da4c | |
| parent | b2a78fec344ead9ffca63ee13018f482392bf09d (diff) | |
| download | linux-23308af722fefed00af5f238024c11710938fba3.tar.xz | |
blk-cgroup: fix disk reference leak in blkcg_maybe_throttle_current()
Add the missing put_disk() on the error path in
blkcg_maybe_throttle_current(). When blkcg lookup, blkg lookup, or
blkg_tryget() fails, the function jumps to the out label which only
calls rcu_read_unlock() but does not release the disk reference acquired
by blkcg_schedule_throttle() via get_device(). Since current->throttle_disk
is already set to NULL before the lookup, blkcg_exit() cannot release
this reference either, causing the disk to never be freed.
Restore the reference release that was present as blk_put_queue() in the
original code but was inadvertently dropped during the conversion from
request_queue to gendisk.
Fixes: f05837ed73d0 ("blk-cgroup: store a gendisk to throttle in struct task_struct")
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260331085054.46857-1-liu.yun@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | block/blk-cgroup.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 2d7b18eb7291..554c87bb4a86 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -2037,6 +2037,7 @@ void blkcg_maybe_throttle_current(void) return; out: rcu_read_unlock(); + put_disk(disk); } /** |
