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:   Thu, 19 Sep 2019 22:56:15 -0400 (EDT)
From:   Nicolas Pitre <nico@...xnic.net>
To:     Greg KH <gregkh@...uxfoundation.org>
cc:     Xiaoming Ni <nixiaoming@...wei.com>, penberg@...helsinki.fi,
        jslaby@...e.com, textshell@...uujin.de, sam@...nborg.org,
        daniel.vetter@...ll.ch, mpatocka@...hat.com, ghalat@...hat.com,
        linux-kernel@...r.kernel.org, yangyingliang@...wei.com,
        yuehaibing@...wei.com, zengweilin@...wei.com
Subject: Re: [PATCH] tty:vt: Add check the return value of kzalloc to avoid
 oops

On Thu, 19 Sep 2019, Greg KH wrote:

> On Thu, Sep 19, 2019 at 05:18:15PM +0800, Xiaoming Ni wrote:
> > Using kzalloc() to allocate memory in function con_init(), but not
> > checking the return value, there is a risk of null pointer references
> > oops.
> > 
> > Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
> 
> We keep having this be "reported" :(

Something probably needs to be "communicated" about that.

> >  		vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
> > +		if (unlikely(!vc)) {
> > +			pr_warn("%s:failed to allocate memory for the %u vc\n",
> > +					__func__, currcons);
> > +			break;
> > +		}
> 
> At init, this really can not happen.  Have you see it ever happen?

This is maybe too subtle a fact. The "communication" could be done with 
some GFP_WONTFAIL flag, and have the allocator simply pannic() if it 
ever fails.


Nicolas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ