diff mbox series

[1/1] printk: fix NULL ptr dereference in nbcon driver

Message ID 20240222101626.1142-2-quic_chandna@quicinc.com
State New
Headers show
Series Fix NULL ptr dereference in nbcon driver | expand

Commit Message

Sahil Chandna Feb. 22, 2024, 10:16 a.m. UTC
Add a check for NULL console in nbcon driver.

Signed-off-by: Sahil Chandna <quic_chandna@quicinc.com>
---
 printk/nbcon.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index e697a8e..398739d 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -1623,6 +1623,9 @@  void nbcon_release(struct uart_port *up)
 		.prio		= NBCON_PRIO_NORMAL,
 	};
 
+	if (!con)
+		return;
+
 	if (!con->locked_port)
 		return;