Re: [PATCH v3] vt: Fix a missing-check bug in drivers/tty/vt/vt.c

2019-05-22 Thread Nicolas Pitre
On Wed, 22 May 2019, Gen Zhang wrote: > In function con_init(), the pointer variable vc_cons[currcons].d, vc and > vc->vc_screenbuf is allocated a memory space via kzalloc(). And they are > used in the following codes. > However, when there is a memory allocation error, kzalloc() can fail. > Thus

[PATCH v3] vt: Fix a missing-check bug in drivers/tty/vt/vt.c

2019-05-22 Thread Gen Zhang
In function con_init(), the pointer variable vc_cons[currcons].d, vc and vc->vc_screenbuf is allocated a memory space via kzalloc(). And they are used in the following codes. However, when there is a memory allocation error, kzalloc() can fail. Thus null pointer (vc_cons[currcons].d, vc and vc->vc_

Re: [PATCH v3] vt: Fix a missing-check bug in drivers/tty/vt/vt.c

2019-05-20 Thread Oleksandr Natalenko
Cc'ing Grzegorz. On Tue, May 21, 2019 at 11:21:18AM +0800, Gen Zhang wrote: > On Mon, May 20, 2019 at 10:55:40PM -0400, Nicolas Pitre wrote: > > As soon as you release the lock, another thread could come along and > > start using the memory pointed by vc_cons[currcons].d you're about to > > free

Re: [PATCH v3] vt: Fix a missing-check bug in drivers/tty/vt/vt.c

2019-05-20 Thread Gen Zhang
On Mon, May 20, 2019 at 10:55:40PM -0400, Nicolas Pitre wrote: > As soon as you release the lock, another thread could come along and > start using the memory pointed by vc_cons[currcons].d you're about to > free here. This is unlikely for an initcall, but still. > > You should consider this ord