Skip to content

Commit 8255da6

Browse files
jognessgregkh
authored andcommitted
kdb: Do not assume write() callback available
commit 6d3e0d8cc63221dec670d0ee92ac57961581e975 upstream. It is allowed for consoles to not provide a write() callback. For example ttynull does this. Check if a write() callback is available before using it. Signed-off-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Reviewed-by: Daniel Thompson <[email protected]> Acked-by: Daniel Thompson <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Brian Norris <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 95036d4 commit 8255da6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/debug/kdb/kdb_io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ static void kdb_msg_write(const char *msg, int msg_len)
576576
continue;
577577
if (c == dbg_io_ops->cons)
578578
continue;
579+
if (!c->write)
580+
continue;
579581
/*
580582
* Set oops_in_progress to encourage the console drivers to
581583
* disregard their internal spin locks: in the current calling

0 commit comments

Comments
 (0)