In the Linux kernel, the following vulnerability has been resolved:
tty: serial: fsllpuart: mark last busy before uartaddoneport
With "earlycon initcall_debug=1 loglevel=8" in bootargs, kernel sometimes boot hang. It is because normal console still is not ready, but runtime suspend is called, so early console putchar will hang in waiting TRDE set in UARTSTAT.
The lpuart driver has auto suspend delay set to 3000ms, but during uartaddoneport, a child device serial ctrl will added and probed with its pm runtime enabled(see serialctrl.c). The runtime suspend call path is: deviceadd |-> busprobedevice |->deviceinitialprobe |->deviceattach |-> pmruntimegetsync(dev->parent); |-> pmrequestidle(dev); |-> pmruntime_put(dev->parent);
So in the end, before normal console ready, the lpuart get runtime suspended. And earlycon putchar will hang.
To address the issue, mark last busy just after pmruntimeenable, three seconds is long enough to switch from bootconsole to normal console.