Skip to content

Commit 3051247

Browse files
Ming Leiaxboe
authored andcommitted
block: fix kobject leak in blk_unregister_queue
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 <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 4cdf1bd commit 3051247

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
@@ -960,4 +960,5 @@ void blk_unregister_queue(struct gendisk *disk)
960960
elevator_set_none(q);
961961

962962
blk_debugfs_remove(disk);
963+
kobject_put(&disk->queue_kobj);
963964
}

0 commit comments

Comments
 (0)