Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35407947rwd; Mon, 10 Jul 2023 07:05:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlFH0CpRLLITxLo7yDn6V1doUN319GS0N6XqkT6PpSqJfMRgCZ8g7P+02UzFtN0ScoeifQ0w X-Received: by 2002:a92:c803:0:b0:345:7cfd:7bc8 with SMTP id v3-20020a92c803000000b003457cfd7bc8mr2871427iln.23.1688997956103; Mon, 10 Jul 2023 07:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688997956; cv=none; d=google.com; s=arc-20160816; b=LLImxB5Ip81vp6u5I/K2x6KcDQa4lvxBG6rzcV2a7QtCNJCdRnZ95zCAmGaXa4LtqJ npJAzjHYElt36wQpZ5uMFjiQO3tTP/k9hTd2uuXwbGs1e5S89gA5NfL+z+fJEbZa8+uW 2sDGwoyXg50nzlQ7iyQUyEzT5IPjArAUes7RuaK3mfU41oC4HOgb+f88HeQkTyxbERX2 t7zkvjggEbS2gysIhw5aQkYw96AcKJXDpILeughcr7BQXqQiDmKauZsb+p8Ijg5TRjFZ YsGe/HSsfbro/QK7ADV2TD80ID9uO4RK21YFDXWmyyvLlT9iOIxExXL+qaGuRP5sOelQ dIuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=B9NLpZDV0rDJscklMexuqubYAOrVOVFP5G0SfhKaC40=; fh=snfNmeYpwN2wMIrLpkrEvSNSjBz+ljiy3c1UurUR8io=; b=ZRnUAzM4yHZ0rmyGAplQR7JiiP4RiVWXOCPzHX1MNoFiXKZ+/9Ru82FI0P7ejfhKKJ LTkGvWsdk/jQ86J4h5c1lU3dJpKtXp1Kmzck75Z1xIA0x33QIW5v8rry7HxiYv5Sw3XJ /mGXlYXdtAtEMP0+SAMuGOLaiYX3sc2ds/ZWnvgNJO7gFjalI5PB5cuc6hzpnYn2nTcB 655pp52H+2///NZtNR5wvSwfI2tiqox9h5bUWDczrOnuLWl29rCpkbDNQTdNuQgn3Jci srRl9NCHDk17gb1SPAHlywDmbKe0t0mCNYzQzSblVNpfVdvurqiM1ykYvjSz70pqDhCx /wVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mPH34seK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=MimllhSt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot16-20020a17090b3b5000b00265805c4b47si4424582pjb.190.2023.07.10.07.05.43; Mon, 10 Jul 2023 07:05:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mPH34seK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=MimllhSt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232987AbjGJNpe (ORCPT + 99 others); Mon, 10 Jul 2023 09:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbjGJNpb (ORCPT ); Mon, 10 Jul 2023 09:45:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E31FB for ; Mon, 10 Jul 2023 06:45:29 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1688996727; 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=B9NLpZDV0rDJscklMexuqubYAOrVOVFP5G0SfhKaC40=; b=mPH34seK6EKd96789117404thhQ8iF13OLpNr8Rr4KlkQwNJABW99gTYK+7HnIjltRHnN+ 2yJBLZcArEG9Xrwkd0d3MiWAydDpHP2tGyam99KieBiEmInY5CgsIn9vHkwsUk48Ee7eTR zNXJ3sN2/CVr6hYmUfI8t+JcrOZTuJDijmKzFRqMq5CrrEl6NacvXqO8OgPDyAx+LvFEt1 ubf3eSzQxZ1WFEW5moucTAYNP/I+xcORGxd3pkhprECltFA9rFynae9SUdxlVFYQRNtgXP 7eZX3/eMHsZSZlnvQUf8ctTN32aOL3r+d9aTnkOWLj0gjRn2yIF/TpORQgS1FA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1688996727; 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=B9NLpZDV0rDJscklMexuqubYAOrVOVFP5G0SfhKaC40=; b=MimllhStnyB8UVIm3i7qxoahyZlF7eOmcJSKU+Xf2Frp7wMCiRdG+vr3tcFXyKXVdnFhAQ reR+NH86j4GeIbDw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Aaron Tomlin , kgdb-bugreport@lists.sourceforge.net Subject: [PATCH printk v2 1/5] kdb: do not assume write() callback available Date: Mon, 10 Jul 2023 15:51:20 +0206 Message-Id: <20230710134524.25232-2-john.ogness@linutronix.de> In-Reply-To: <20230710134524.25232-1-john.ogness@linutronix.de> References: <20230710134524.25232-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is allowed for consoles to provide no 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 --- 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