On Mon 2020-01-27 11:47:22, Andy Shevchenko wrote: > On Mon, Jan 27, 2020 at 09:48:58AM +0100, Helge Deller wrote: > > On 25.01.20 11:25, Andy Shevchenko wrote: > > > On Fri, Jan 24, 2020 at 09:59:48AM -0800, James Bottomley wrote: > > ... > > > > By the way, consider this code from register_console() > > > > > > for_each_console(bcon) > > > if (bcon->flags & CON_BOOT) > > > unregister_console(bcon); > > > > > > It works based on assumption that next pointer of the just unregistered console > > > is not damaged. So, My initial patch will work in the same way. > > > > Yeah, but that's a typical use-after-free issue, which I wouldn't count on. > > I think here is misinterpretation, i.e. unregister != free. > Entire console code is written in the assumption that console is not being > freed when unregistered. Honestly, I am not sure if this is true for all console drivers and if it is by design. I would prefer to stay on the safe side and keep the original code. Hotplug practices are more and more popular as everything gets virtualized. Best Regards, Petr