public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: eagle black <rochacker@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Russell King <rmk+lkml@arm.linux.org.uk>
Subject: Re: [BUG] It seems that i found a bug in the linux kernel, and it also in the newest kernel version
Date: Sun, 28 Dec 2008 19:17:06 +0100	[thread overview]
Message-ID: <20081228181706.GW32491@kernel.dk> (raw)
In-Reply-To: <cbe409c50812252315w1bb62fa0n3c0e05e7d9432e40@mail.gmail.com>

On Fri, Dec 26 2008, eagle black wrote:
> let's see, int the function elevator_init of block/elevator.c ,
> if the function elevator_init_queue failed for some reason, and the memory
> of elevator_alloc  alloced does not free!
> 
> int elevator_init(struct request_queue *q, char *name)
> {
>         struct elevator_type *e = NULL;
>         struct elevator_queue *eq;
>         int ret = 0;
>         void *data;
> 
>         INIT_LIST_HEAD(&q->queue_head);
>         q->last_merge = NULL;
>         q->end_sector = 0;
>         q->boundary_rq = NULL;
> 
>         if (name) {
>                 e = elevator_get(name);
>                 if (!e)
>                         return -EINVAL;
>         }
> 
>         if (!e && *chosen_elevator) {
>                 e = elevator_get(chosen_elevator);
>                 if (!e)
>                         printk(KERN_ERR "I/O scheduler %s not found\n",
>                                                         chosen_elevator);
>         }
> 
>         if (!e) {
>                 e = elevator_get(CONFIG_DEFAULT_IOSCHED);
>                 if (!e) {
>                         printk(KERN_ERR
>                                 "Default I/O scheduler not found. " \
>                                 "Using noop.\n");
>                         e = elevator_get("noop");
>                 }
>         }
> 
>         eq = elevator_alloc(q, e);
>         if (!eq)
>                 return -ENOMEM;
> 
>         data = elevator_init_queue(q, eq);
>         if (!data) {
>                 kobject_put(&eq->kobj);

See the kobject_put() there. It'll put the one and only reference to
this kobject, which wil end up in elevator_release() that then frees
'eq' (called 'e' there).

-- 
Jens Axboe


      parent reply	other threads:[~2008-12-28 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cbe409c50812252315w1bb62fa0n3c0e05e7d9432e40@mail.gmail.com>
2008-12-26  7:53 ` [BUG] It seems that i found a bug in the linux kernel, and it also in the newest kernel version eagle black
2008-12-28 18:17 ` Jens Axboe [this message]

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=20081228181706.GW32491@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=rochacker@gmail.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox