From: Ming Lei Date: Fri, 11 Jul 2025 08:30:09 +0000 (+0800) Subject: block: fix kobject leak in blk_unregister_queue X-Git-Tag: v6.15.8~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3c48fc43319183365a49057078ab88123acc22d;p=thirdparty%2Fkernel%2Fstable.git block: fix kobject leak in blk_unregister_queue [ Upstream commit 3051247e4faa32a3d90c762a243c2c62dde310db ] 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: 2bd85221a625 ("block: untangle request_queue refcounting from sysfs") Cc: Christoph Hellwig Signed-off-by: Ming Lei Link: https://lore.kernel.org/r/20250711083009.2574432-1-ming.lei@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 1f9b45b0b9ee7..12a5059089a2f 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -964,4 +964,5 @@ void blk_unregister_queue(struct gendisk *disk) kobject_del(&disk->queue_kobj); blk_debugfs_remove(disk); + kobject_put(&disk->queue_kobj); }