public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zhong <floridsleeves@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tony.luck@intel.com, ccross@android.com, anton@enomsg.org,
	keescook@chromium.org, john.ogness@linutronix.de,
	rostedt@goodmis.org, senozhatsky@chromium.org, pmladek@suse.com,
	Li Zhong <floridsleeves@gmail.com>
Subject: [PATCH v1] kernel/printk: check return value of console_trylock()
Date: Fri, 16 Sep 2022 18:58:52 -0700	[thread overview]
Message-ID: <20220917015852.3833820-1-floridsleeves@gmail.com> (raw)

Check the console_trylock() return value in case it fails.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 kernel/printk/printk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a1a81fd9889b..2c6a0484315b 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2937,7 +2937,8 @@ void console_flush_on_panic(enum con_flush_mode mode)
 	 * context and we don't want to get preempted while flushing,
 	 * ensure may_schedule is cleared.
 	 */
-	console_trylock();
+	if (!console_trylock())
+		return;
 	console_may_schedule = 0;
 
 	if (mode == CONSOLE_REPLAY_ALL) {
-- 
2.25.1


             reply	other threads:[~2022-09-17  1:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17  1:58 Li Zhong [this message]
2022-09-18 13:11 ` [PATCH v1] kernel/printk: check return value of console_trylock() Sergey Senozhatsky
2022-09-19 22:28   ` Li Zhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220917015852.3833820-1-floridsleeves@gmail.com \
    --to=floridsleeves@gmail.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=john.ogness@linutronix.de \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox