From patchwork Thu Mar 2 19:56:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 63537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp42247wrd; Thu, 2 Mar 2023 12:00:18 -0800 (PST) X-Google-Smtp-Source: AK7set87iPdZ21rzkZlh2Pi/eO8rYQQAFirDuIfVXIq/OeJJBQRD065R/wgkzZg0qfUkIGNPVa4s X-Received: by 2002:a17:902:c401:b0:19e:83e7:9d17 with SMTP id k1-20020a170902c40100b0019e83e79d17mr1860671plk.23.1677787217719; Thu, 02 Mar 2023 12:00:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677787217; cv=none; d=google.com; s=arc-20160816; b=ZwHcd61FvBQLJlm0bA129DBbTsx6e7b3kDXGG6OE73xzsn+bT1/LV04dMwwwG/QVYq 7Z5KLc6uLCZhwVsK12rekAAh6BnbGZkgbbserfvDaa1muyMHE4FqGSa6UcBRCIv4dmOX 0t4+csyy8XJ+orVC+zXA+fUfDwlP2opR/PVfB3syAbhxEqT8IQIXwUbScj5wnLgdxPHh HvR4RWGf5eIQcHG+qVXojUAGnWPPztg3veOR+Tpk4EGu7pCyx8R5/0D+v8L+EKTYyp2j oc8Y4EEpSqrfGAeiv7iF9ByyEIWSUG4PCV23V8knQp74FwSQyDvpvWgFuaITt0G0+K5u /tMQ== 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=bn4hK/pc8yfuTHf2lVQ6K39OCmfHLmDwBEQ4LD+VvX8=; b=NmYQ2uFEjfbbF5Mo+ox8EP+G/4OZnLG4gDDesA8yUt0pfWg7QvssX6pl0WJJpYFoEG h3Kea8TD7zWORvVHrr4OsjpwCYhFvoq4dR8Lf8AZUzgiXad6n+D3mQg4ViFWsKa5OKrJ wfmD4s37TqTIFK9U7ACY8j2vnIg0xoqzvePttuTDgb+zVuGztdV5u6vXMP49yokJJNn5 F2yKmKmcQKB3KyNbhRHehdvvAf/XzxR6Zia6h39tj4cy8l/ZOUMYiyZNw/7+84W28CoG T5dpt3PGvBFS/gzHDSCgCenPGcO8Qva5Tkf92Dkq7CExtjPQDfvBKK/glZYY9dYYrqx2 Zf3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="sVHSx/LE"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id km14-20020a17090327ce00b0019d20f7db09si142705plb.597.2023.03.02.11.59.34; Thu, 02 Mar 2023 12:00:17 -0800 (PST) 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="sVHSx/LE"; 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 S230071AbjCBT6C (ORCPT + 99 others); Thu, 2 Mar 2023 14:58:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjCBT5p (ORCPT ); Thu, 2 Mar 2023 14:57:45 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58EF54743A for ; Thu, 2 Mar 2023 11:57:44 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1677787062; 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=bn4hK/pc8yfuTHf2lVQ6K39OCmfHLmDwBEQ4LD+VvX8=; b=sVHSx/LE7UqM7m9QqJqsI82I3YhkAegnS1wj0KV1SpI9PJKxnb/I07juk3E23hRkXfc2D6 E93VCEpd5hBOfkTcqtKMqdM9Bqq4/eZi6MzoPvWe4psYtIkpoQu60kDH0sLmcaiU7QkY0X oDq5R/XP1V0TGr6dCS4tfdp9e3DMGiTaUD1jcFG32b1bHe9GxpBVT+NeVHY6xsi7tXZV5h z81xAF0OvvZ4rAgVg7Rm83bheDM1no0axFc4D6eWG0otXxz5IZgHm1Xf85D/23B5Hs4Njo BlNGym9rw1vlZ2oDc+dInihAYTmNb2UuXy5Ssxs8wXPTFtkEMuf3GwXXZdlUQA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677787062; 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=bn4hK/pc8yfuTHf2lVQ6K39OCmfHLmDwBEQ4LD+VvX8=; b=95Ms7ku4PtEVQkCu9sJ1bRajCtfp7nzS53jwqnhi/CkI9LIirtg2epuND9iUDCiYb5LQd8 TSNC5vetA4XLnrDA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Aaron Tomlin , Luis Chamberlain , kgdb-bugreport@lists.sourceforge.net Subject: [PATCH printk v1 01/18] kdb: do not assume write() callback available Date: Thu, 2 Mar 2023 21:02:01 +0106 Message-Id: <20230302195618.156940-2-john.ogness@linutronix.de> In-Reply-To: <20230302195618.156940-1-john.ogness@linutronix.de> References: <20230302195618.156940-1-john.ogness@linutronix.de> MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759287409803306619?= X-GMAIL-MSGID: =?utf-8?q?1759287409803306619?= 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 Acked-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