lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251205-nbcon-device-cb-fix-v1-1-906bdff5760b@suse.com>
Date: Fri, 05 Dec 2025 15:34:32 -0300
From: Marcos Paulo de Souza <mpdesouza@...e.com>
To: Petr Mladek <pmladek@...e.com>, Steven Rostedt <rostedt@...dmis.org>, 
 John Ogness <john.ogness@...utronix.de>, 
 Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: linux-kernel@...r.kernel.org, marcos@...esouza.com, 
 Marcos Paulo de Souza <mpdesouza@...e.com>
Subject: [PATCH] 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@...e.com>
---
I found this issue while creating a custom kernel module that implements
the nbcon interfaces.
---
 kernel/printk/nbcon.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index 3fa403f9831f..02809c44d7ea 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -1764,6 +1764,10 @@ bool nbcon_alloc(struct console *con)
 	if (WARN_ON(!con->write_thread))
 		return false;
 
+	/* The device_lock() and device_unlock() callbacks are mandatory. */
+	if (WARN_ON(!con->device_lock || !con->device_unlock))
+		return false;
+
 	rcuwait_init(&con->rcuwait);
 	init_irq_work(&con->irq_work, nbcon_irq_work);
 	atomic_long_set(&ACCESS_PRIVATE(con, nbcon_prev_seq), -1UL);

---
base-commit: 322530a9c2ab1da67e5b0988fa29aca64d96ec8f
change-id: 20251205-nbcon-device-cb-fix-7ce745a21ba8

Best regards,
--  
Marcos Paulo de Souza <mpdesouza@...e.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ