diff options
author | Petr Mladek <pmladek@suse.com> | 2021-08-30 16:33:04 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2021-08-30 16:33:04 +0200 |
commit | 715d3edb79c6c2b68dedf348b0aa96e61f360292 (patch) | |
tree | 4d8de5ebfd2d3fea8278076fc76c51147b2e0344 /kernel/printk | |
parent | Merge branch 'for-5.15-verbose-console' into for-linus (diff) | |
parent | printk/console: Check consistent sequence number when handling race in consol... (diff) | |
download | linux-715d3edb79c6c2b68dedf348b0aa96e61f360292.tar.xz linux-715d3edb79c6c2b68dedf348b0aa96e61f360292.zip |
Merge branch 'rework/fixup-for-5.15' into for-linus
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 87b8e7c81368..776e3565f013 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2533,6 +2533,7 @@ void console_unlock(void) bool do_cond_resched, retry; struct printk_info info; struct printk_record r; + u64 __maybe_unused next_seq; if (console_suspended) { up_console_sem(); @@ -2642,8 +2643,10 @@ skip: cond_resched(); } - console_locked = 0; + /* Get consistent value of the next-to-be-used sequence number. */ + next_seq = console_seq; + console_locked = 0; up_console_sem(); /* @@ -2652,7 +2655,7 @@ skip: * there's a new owner and the console_unlock() from them will do the * flush, no worries. */ - retry = prb_read_valid(prb, console_seq, NULL); + retry = prb_read_valid(prb, next_seq, NULL); printk_safe_exit_irqrestore(flags); if (retry && console_trylock()) |