[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090116092859.GD4305@elte.hu>
Date: Fri, 16 Jan 2009 10:28:59 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Mike Travis <travis@....com>
Cc: Rusty Russell <rusty@...tcorp.com.au>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PULL}: latest tip/cpus4096 changes
* Mike Travis <travis@....com> wrote:
> diff --git a/kernel/kgdb.c b/kernel/kgdb.c
> index e4dcfb2..21fde60 100644
> --- a/kernel/kgdb.c
> +++ b/kernel/kgdb.c
> @@ -72,7 +72,7 @@ struct kgdb_state {
> static struct debuggerinfo_struct {
> void *debuggerinfo;
> struct task_struct *task;
> -} kgdb_info[NR_CPUS];
> +} *kgdb_info;
>
> /**
> * kgdb_connected - Is a host GDB connected to us?
> @@ -1651,6 +1651,13 @@ int kgdb_register_io_module(struct kgdb_io *new_kgdb_io_ops)
> return -EBUSY;
> }
>
> + kgdb_info = kmalloc(nr_cpu_ids * sizeof(*kgdb_info), GFP_KERNEL);
> + if (unlikely(!kgdb_info)) {
> + spin_unlock(&kgdb_registration_lock);
> + printk(KERN_ERR "kgdb: No memory for kgdb_info\n");
> + return -ENOMEM;
> + }
> +
> if (new_kgdb_io_ops->init) {
> err = new_kgdb_io_ops->init();
> if (err) {
Look how it continues:
spin_unlock(&kgdb_registration_lock);
return err;
}
}
See the memory leak? This is _trivially_ broken. When you add dynamic
allocation to any codepath you _need_ to be careul and you need to check
all interim paths of return.
Also, please submit kgdb patches via the KGDB maintainer:
KGDB
P: Jason Wessel
M: jason.wessel@...driver.com
L: kgdb-bugreport@...ts.sourceforge.net
S: Maintained
Ingo
--
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