[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20081228181706.GW32491@kernel.dk>
Date: Sun, 28 Dec 2008 19:17:06 +0100
From: Jens Axboe <jens.axboe@...cle.com>
To: eagle black <rochacker@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Russell King <rmk+lkml@....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
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists