public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PULL}: latest tip/cpus4096 changes
Date: Fri, 16 Jan 2009 09:54:22 -0800	[thread overview]
Message-ID: <4970C9CE.6060208@sgi.com> (raw)
In-Reply-To: <20090116092859.GD4305@elte.hu>

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


  reply	other threads:[~2009-01-16 17:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16  9:05 [PULL}: latest tip/cpus4096 changes Mike Travis
2009-01-16  9:25 ` Ingo Molnar
2009-01-16 17:53   ` Mike Travis
2009-01-16 22:30     ` Ingo Molnar
2009-01-16 23:22       ` [PATCH] x86: put trigger in to detect mismatched apic versions Mike Travis
2009-01-17  0:06         ` Mike Travis
2009-01-17  3:07         ` Jack Steiner
2009-01-18 19:08           ` Ingo Molnar
2009-01-18 21:25             ` Jack Steiner
2009-01-19 17:08               ` Mike Travis
2009-01-18 19:04         ` Ingo Molnar
2009-01-16  9:28 ` [PULL}: latest tip/cpus4096 changes Ingo Molnar
2009-01-16 17:54   ` Mike Travis [this message]
2009-01-16  9:34 ` Ingo Molnar
2009-01-16 17:08   ` Jeremy Fitzhardinge
2009-01-16 19:55     ` Mike Travis
2009-01-16 21:15       ` Jeremy Fitzhardinge
2009-01-16 17:55   ` Mike Travis
2009-01-16 14:25 ` Ingo Molnar
2009-01-16 18:03   ` Mike Travis
2009-01-16 22:32     ` Ingo Molnar

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=4970C9CE.6060208@sgi.com \
    --to=travis@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    /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