From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4044C001B0 for ; Mon, 17 Jul 2023 19:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjGQTqU (ORCPT ); Mon, 17 Jul 2023 15:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbjGQTqM (ORCPT ); Mon, 17 Jul 2023 15:46:12 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02677129 for ; Mon, 17 Jul 2023 12:46:12 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1689623170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xJlaA7aw7VfN9sYStH6KtmsbXY1A2Osy2reIpHftB/8=; b=hLXqcX9TNwR0vfRhp+zeVqQ8N5qReqFQ0GcOwV5pqfcy0SanXa8hWsfU+muKGB0llivZee CaR2IrrEwJwNVSQHKBvSBf8Wyt8MQi4VY2oEk1BtjUQbCDqF5ZiWXmuQSvYJCt9AG8QtUD FmHRrSHhw+JYxMFz5fu5tSohEdrIvTDW28EowF5cLMSbxZwybP3hp3J8CWkXQMY0okus6+ Myr2hVS3HoQHhup5HvCOWsO/JdMkI0RO/l/9JGjUY+E4L21D71dJwWinrymK6qnyS7M6bS sMGHeH3rS9/GQEkgXqMMaQlRfBpdrGRI/sBKY6XobFp1+bGqEqmlR5sjsnUlIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1689623170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xJlaA7aw7VfN9sYStH6KtmsbXY1A2Osy2reIpHftB/8=; b=+bp4XZEFJTjresY54VEvYmJiPjGq31ehBWLMsXYtqk50RYYNVlBMTGYTf2CAsUW2/xaRAm xlEPZitTFrBbAuCw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Aaron Tomlin Subject: [PATCH printk v3 1/7] kdb: Do not assume write() callback available Date: Mon, 17 Jul 2023 21:52:01 +0206 Message-Id: <20230717194607.145135-2-john.ogness@linutronix.de> In-Reply-To: <20230717194607.145135-1-john.ogness@linutronix.de> References: <20230717194607.145135-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Petr Mladek Reviewed-by: Douglas Anderson Reviewed-by: Daniel Thompson Acked-by: Daniel Thompson Reviewed-by: Sergey Senozhatsky --- kernel/debug/kdb/kdb_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 5c7e9ba7cd6b..e9139dfc1f0a 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -576,6 +576,8 @@ static void kdb_msg_write(const char *msg, int msg_len) continue; if (c == dbg_io_ops->cons) continue; + if (!c->write) + continue; /* * Set oops_in_progress to encourage the console drivers to * disregard their internal spin locks: in the current calling -- 2.30.2