From: Nate Diller Date: Sun, 30 Oct 2005 23:02:24 +0000 (-0800) Subject: [PATCH] block cleanups: Fix iosched module refcount leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2ca7d93bb27876e5fd4ebfcb3b00627107bdad4d;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [PATCH] block cleanups: Fix iosched module refcount leak If the requested I/O scheduler is already in place, elevator_switch simply leaves the queue alone, and returns. However, it forgets to call elevator_put, so 'echo [current_sched] > /sys/block/[dev]/queue/scheduler' will leak a reference, causing the current_sched module to be permanently pinned in memory. Signed-off-by: Nate Diller Acked-by: Jens Axboe Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 3b652eba2d20..36f1057084b0 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c @@ -753,8 +753,10 @@ ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count) return -EINVAL; } - if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) + if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) { + elevator_put(e); return count; + } elevator_switch(q, e); return count;