From: Marcos Paulo de Souza Date: Mon, 8 Dec 2025 14:06:16 +0000 (-0300) Subject: printk: nbcon: Check for device_{lock,unlock} callbacks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdfcca65e7a681f7511a5c15501a01dd855f6d23;p=thirdparty%2Fkernel%2Flinux.git printk: nbcon: Check for device_{lock,unlock} callbacks These callbacks are necessary to synchronize ->write_thread callback against other operations using the same device. Signed-off-by: Marcos Paulo de Souza Reviewed-by: John Ogness Link: https://patch.msgid.link/20251208-nbcon-device-cb-fix-v2-1-36be8d195123@suse.com Signed-off-by: Petr Mladek --- diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index 3fa403f9831f0..1dfc4a6a44bf4 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -1760,9 +1760,12 @@ bool nbcon_alloc(struct console *con) /* Synchronize the kthread start. */ lockdep_assert_console_list_lock_held(); - /* The write_thread() callback is mandatory. */ - if (WARN_ON(!con->write_thread)) + /* Check for mandatory nbcon callbacks. */ + if (WARN_ON(!con->write_thread || + !con->device_lock || + !con->device_unlock)) { return false; + } rcuwait_init(&con->rcuwait); init_irq_work(&con->irq_work, nbcon_irq_work);