All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nate Diller <nate@namesys.com>
To: axboe@suse.de, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] block cleanups: Fix iosched module refcount leak
Date: Tue, 27 Sep 2005 15:20:05 -0700	[thread overview]
Message-ID: <4339C595.3080308@namesys.com> (raw)

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.

This patchset is against 2.6.14-rc2-mm1, but should apply to anything recent.

NATE

Signed-off-by: Nate Diller <nate@namesys.com>

--- a/drivers/block/elevator.c	2005-09-26 19:17:59.000000000 -0700
+++ b/drivers/block/elevator.c	2005-09-27 11:13:15.000000000 -0700
@@ -692,8 +692,10 @@ ssize_t elv_iosched_store(request_queue_
  		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;

             reply	other threads:[~2005-09-27 22:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-27 22:20 Nate Diller [this message]
2005-09-27 22:40 ` [PATCH 1/3] block cleanups: Fix iosched module refcount leak Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4339C595.3080308@namesys.com \
    --to=nate@namesys.com \
    --cc=akpm@osdl.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.