Commit 2ca7d93bb27876e5fd4ebfcb3b00627107bdad4d
Committed by
Linus Torvalds
1 parent
3fa63c7d82
Exists in
master
and in
7 other branches
[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 <nate@namesys.com> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
drivers/block/elevator.c
... | ... | @@ -753,8 +753,10 @@ |
753 | 753 | return -EINVAL; |
754 | 754 | } |
755 | 755 | |
756 | - if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) | |
756 | + if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) { | |
757 | + elevator_put(e); | |
757 | 758 | return count; |
759 | + } | |
758 | 760 | |
759 | 761 | elevator_switch(q, e); |
760 | 762 | return count; |