[lkml]   [2019]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] vt: Fix a missing-check bug in drivers/tty/vt/vt.c
On Tue, May 21, 2019 at 12:30:38AM -0400, Nicolas Pitre wrote:
> Now imagine that MIN_NR_CONSOLES is defined to 10 instead of 1.
> What happens with allocated memory if the err_vc condition is met on the
> 5th loop?
Yes, vc->vc_screenbuf from the last loop is still not freed, right? I
don't have idea to solve this one. Could please give some advice? Since
we have to consider the err_vc condition.

> If err_vc_screenbuf condition is encountered on the 5th loop (curcons =
> 4), what is the value of vc_cons[4].d? Isn't it the same as vc that you
> just freed?
> Nicolas
Thanks for your explaination! You mean a double free situation may
happen, right? But in vc_allocate() there is also such a kfree(vc) and
vc_cons[currcons].d = NULL operation. This situation is really confusing

 \ /
  Last update: 2019-05-21 09:40    [W:0.054 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site