In the Linux kernel, the following vulnerability has been resolved: tty: xilinxuartps: split sysrq handling lockdep detects the following circular locking dependency: CPU 0 CPU 1 ========================== ============================ cdnsuartisr() printk() uartportlock(port) consolelock() cdnsuartconsolewrite() if (!port->sysrq) uartportlock(port) uarthandlebreak() port->sysrq = ... uarthandlesysrqchar() printk() consolelock() The fixed commit attempts to avoid this situation by only taking the port lock in cdnsuartconsolewrite if port->sysrq unset. However, if (as shown above) cdnsuartconsole_write runs before port->sysrq is set, then it will try to take the port lock anyway. This may result in a deadlock. Fix this by splitting sysrq handling into two parts. We use the prepare helper under the port lock and defer handling until we release the lock.