lkml.org 
[lkml]   [2009]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PULL}: latest tip/cpus4096 changes
Ingo Molnar wrote:
> * Mike Travis <travis@sgi.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@windriver.com
> L: kgdb-bugreport@lists.sourceforge.net
> S: Maintained
>
> Ingo

Yes, you're right I did miss that. And I'll send it to Jason.

Thanks,
MIke



\
 
 \ /
  Last update: 2009-01-16 18:57    [W:0.195 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site