Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5992134rwp; Mon, 17 Jul 2023 12:57:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlGVdAat8BI1ecfaM+m1Pss/krV45kwukPShVZINHJ2SqxrAg3vPs5WsReZPR63hdYmzoBFE X-Received: by 2002:a17:90a:4282:b0:263:f521:da3e with SMTP id p2-20020a17090a428200b00263f521da3emr13384723pjg.2.1689623821985; Mon, 17 Jul 2023 12:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689623821; cv=none; d=google.com; s=arc-20160816; b=L3VBJXbjVBCQiH4d0lfgfO2TyofFQ1v6aTuQAfITjY42uubR+AujezBQUipRt/F1zn K6Q8Vl+F0fFFxYKxBoXdtiEUsHyLLEyEP9VMHvbP7dMfFL6N0hMAtmzWQ6fyxkEMw5JR khQO1DFSi8HbVjvAshtqm2rA9fkC+p8O1oOdx6sDOSC1rqy+6Wo9MzyuqhYZTQXj0gyM edD1Zyy49TLt8XGAWlYkL5wppdnD1Nb0lHsY8BsrYqaJtCrgQhrCYY0zZ2Yd8L0OT+q0 7Gz6MhxgDYZcegTDlA1afQbOdDW15gb34hyR/YKhddAYfA4gu731uKZrew1NweYlA3U3 arJw== 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=xJlaA7aw7VfN9sYStH6KtmsbXY1A2Osy2reIpHftB/8=; fh=FmGDdgxgAqjzIwBffCEQi+NWFaUddSrn2FgJHvKhtP8=; b=oDhWlVT0ClpeVbOSRJF3QPPwePd/N5sxllGL8fWg4a/x7mIluAihqI3ondiqhspn/J eFGd3I/H++20hxcp4FMrKEGFOGJ0nOnarUuDgWIHwi8ebgLcytXJKFzDDgB7mGYMxazF OJBgF5u5LmzJrltKD/BARlUsMfYDM7AiQTAc5toUXX+H22GVKBARNAHJPboqR1L/0dqm L7JfaQJYdeGGq8HYx1MrgIm+nviij0x+HIwATk147rzR3WEXMUoUqf+5M0PftCbbsVTe 6WOrPE2rggEjddSr0cZ/EYSXkxPmbpHqoLVertWVRFFukvipxN7nL7mR2lb2WfdIwwCA IBmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hLXqcX9T; dkim=neutral (no key) header.i=@linutronix.de; 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 v1-20020a17090a4ec100b00261113f2843si5043419pjl.131.2023.07.17.12.56.49; Mon, 17 Jul 2023 12:57:01 -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=hLXqcX9T; dkim=neutral (no key) header.i=@linutronix.de; 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 S231636AbjGQTqT (ORCPT + 99 others); Mon, 17 Jul 2023 15:46:19 -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 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 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