diff options
| author | John Ogness <john.ogness@linutronix.de> | 2026-07-03 16:20:31 +0206 |
|---|---|---|
| committer | Petr Mladek <pmladek@suse.com> | 2026-07-09 13:33:17 +0200 |
| commit | 36630cafbeede0b64c370edb2f7b4094327ee1e0 (patch) | |
| tree | 8cff4ca2c3432856c8e57a02c242b88de04246ef /tools/lib/python | |
| parent | 3a341cb3a2c2879732bc9cf006caa6a087b82241 (diff) | |
| download | linux-36630cafbeede0b64c370edb2f7b4094327ee1e0.tar.gz linux-36630cafbeede0b64c370edb2f7b4094327ee1e0.zip | |
printk: Fix possible console use-after-free
When emitting a record via legacy printing, it is possible that a handover
to another legacy printing context occurs. When a context has performed a
handover, the console SRCU read lock is released and the pointer to the
console struct might now be invalid. Therefore, after calling
nbcon_legacy_emit_next_record() or console_emit_next_record(), it is
necessary to check if a handover occurred _before_ further @con usage.
Sashiko pointed out that console_flush_one_record() was not doing this.
In console_flush_one_record(), after emitting a record, move the further
usage of @con after the handover check.
Fixes: c158834b223f ("printk: nbcon: Use nbcon consoles in console_flush_all()")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/lkml/20260630170903.099D61F000E9@smtp.kernel.org
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://patch.msgid.link/20260703141521.202813-1-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
