lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 Jan 2009 09:54:22 -0800
From:	Mike Travis <travis@....com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Rusty Russell <rusty@...tcorp.com.au>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PULL}: latest tip/cpus4096 changes

Ingo Molnar wrote:
> * 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

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

Thanks,
MIke

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ