Skip to content

Commit bdfcca6

Browse files
marcospspmladek
authored andcommitted
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 <mpdesouza@suse.com> Reviewed-by: John Ogness <john.ogness@linutronix.de> Link: https://patch.msgid.link/20251208-nbcon-device-cb-fix-v2-1-36be8d195123@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent 4d38b88 commit bdfcca6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

kernel/printk/nbcon.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,9 +1760,12 @@ bool nbcon_alloc(struct console *con)
17601760
/* Synchronize the kthread start. */
17611761
lockdep_assert_console_list_lock_held();
17621762

1763-
/* The write_thread() callback is mandatory. */
1764-
if (WARN_ON(!con->write_thread))
1763+
/* Check for mandatory nbcon callbacks. */
1764+
if (WARN_ON(!con->write_thread ||
1765+
!con->device_lock ||
1766+
!con->device_unlock)) {
17651767
return false;
1768+
}
17661769

17671770
rcuwait_init(&con->rcuwait);
17681771
init_irq_work(&con->irq_work, nbcon_irq_work);

0 commit comments

Comments
 (0)