]> git.ipfire.org Git - thirdparty/linux.git/commit
block: fix module reference leak in mq-deadline I/O scheduler
authorNilay Shroff <nilay@linux.ibm.com>
Sat, 19 Jul 2025 13:26:47 +0000 (18:56 +0530)
committerJens Axboe <axboe@kernel.dk>
Sun, 20 Jul 2025 19:18:13 +0000 (13:18 -0600)
commit1966554b2e82b89d4f6490f430ce76a379e23f1f
tree97b50573bcdcafcb0470f7e8c8ba6e6d1cfdc7af
parent2680efde75ccdd745da7ae6f5e30026f70439588
block: fix module reference leak in mq-deadline I/O scheduler

During probe, when the block layer registers a request queue, it
defaults to the mq-deadline I/O scheduler if the device is single-queue
and the mq-deadline module is available. To determine availability, the
elevator_set_default() invokes elevator_find_get(), which increments the
module's reference count. However, this reference is never released,
resulting in a module reference leak that prevents the mq-deadline module
from being unloaded.

This patch fixes the issue by ensuring the acquired module reference is
properly released.

Fixes: 1e44bedbc921 ("block: unifying elevator change")
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250719132722.769536-1-nilay@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/elevator.c