Skip to content

Commit e8767b8

Browse files
Ming Leigregkh
authored andcommitted
block: fix kobject leak in blk_unregister_queue
[ Upstream commit 3051247 ] The kobject for the queue, `disk->queue_kobj`, is initialized with a reference count of 1 via `kobject_init()` in `blk_register_queue()`. While `kobject_del()` is called during the unregister path to remove the kobject from sysfs, the initial reference is never released. Add a call to `kobject_put()` in `blk_unregister_queue()` to properly decrement the reference count and fix the leak. Fixes: 2bd8522 ("block: untangle request_queue refcounting from sysfs") Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250711083009.2574432-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 20648ff commit e8767b8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/blk-sysfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,4 +868,5 @@ void blk_unregister_queue(struct gendisk *disk)
868868
mutex_unlock(&q->sysfs_dir_lock);
869869

870870
blk_debugfs_remove(disk);
871+
kobject_put(&disk->queue_kobj);
871872
}

0 commit comments

Comments
 (0)