Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp401018lqo; Fri, 10 May 2024 03:30:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLP0ONCKmKh+fShRjqNYyboKJsI7dl4G6Q0jLmAVIaUXP88Swf1ZrpBYzulLc/D9/YhP+wll9aC/o/ta/k0/0LZrt+cMpclZpYy1HKgg== X-Google-Smtp-Source: AGHT+IHtf6+HAm/LjzfVV5TDHuvwWg35COqQ5aBANBeUnAKKUh9eCl0rSD/gWhpIgYKVFkR8BoVT X-Received: by 2002:a05:6512:3e17:b0:51d:605e:f0ce with SMTP id 2adb3069b0e04-52210278698mr2488164e87.50.1715337056850; Fri, 10 May 2024 03:30:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715337056; cv=pass; d=google.com; s=arc-20160816; b=UH5f222Olyo+q560k2ltd3X4v+vqgRT8CDO9tKvOkpBdDXRE81/2x/jE8c48FRT+fk JWGP9qo3ZC1TJ9AsUdwZ6L+ivBWsSeNcspRTx4AUVsdc6p/ArXxkFn7Q9QyBa9CsorMR AbXYiRFRug6ysasttFQNf+eSHnHa74bO+cWZjGApG/5z336TBIIDVwOiq/HLQiootD21 v7zTZAyttgTgnd7BtpI1pkL+XI5qBZMcPaC26QqA/pY6MpspKnciikoPJc9OSZ6tHrjK vNG/VwzoLEl9Y6LWE/cmrLdv3EMtjICsZhBazNRTO5D8NHHtybn1haYyWU4H7rSHk70X zxuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Cpd+1uI5omhYD2wj/HwWULTJmMXVCOfVodGWbcrp/kg=; fh=C3qIdExpicXB50C5NC29Ykd+eTqBfSYP8hZmP17Tw1s=; b=N7quBiKDqrVR5SrMCIIR274MAgnZ8NxZBhm1VCEHAm2lMimsFjYt4DyiQlpHaAOTOo HxNGKWRrPqO0QDH7zKwv7c4jwz5BOqPSW6xX6Fk5eBtvOe3vaQcbRgndr+MZeiNt0JBr uPf2xG+fD9Jybmgp6OR4Vku1SUE9Xu7Gy87+o0uZZb9/I27bdnYukx8axniSvvQ4uaCW daq4WVPBjKh87h0oggerfSwe+RKEQX963/NyXur9h4jCA5XN/BAK4xqE71cm6W+nmaRU a0x4mhkVJRloaQTdMA17cVPEAVu3qIYSTjUSGPDhYSW3mz79iFtIjVGihVGC+cDLXEOc JjOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-175593-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175593-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba56fesi185621466b.649.2024.05.10.03.30.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 03:30:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175593-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-175593-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175593-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8C1321F21B1D for ; Fri, 10 May 2024 10:30:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3835168AEF; Fri, 10 May 2024 10:30:27 +0000 (UTC) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F90554677; Fri, 10 May 2024 10:30:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715337027; cv=none; b=LIfM1u4qCrqanODVD+AcSj7V2M5nmJKEpEqqdu87t554QVhb2aUElPNF87gI62xTMDXrN/El3GZ4ZULTxXun9OHYEq7ovF4OES/cNnk64eK5ddteUoK6Je2oBKQ6KJyWxvkxu3/njsYNY7ElxUMiNuNMOys6t+laXxiYr4pCTjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715337027; c=relaxed/simple; bh=xFhHz1KjXpz9Rv+VlQW1WOjFDZBJOu2NMH+tMzfpL+4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KJTojW/J3gS02x9qGaG1fQ5iZI59cOjjgrDfnUGtUnbDP668sAdPyNmySQOJlE90jSEePLF03v1tg8+q3aVZfEUb2LdO+Msqld4KdJ2+gk+ogxML/I5FqR1d4R14IXObfevUgcVBk2/GdAiPytAxRN8AQfoHWq0OvcGv+toly3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-51ffff16400so3074791e87.2; Fri, 10 May 2024 03:30:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715337024; x=1715941824; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Cpd+1uI5omhYD2wj/HwWULTJmMXVCOfVodGWbcrp/kg=; b=ffY8t9h77KCvFn0aFPMxBFuTKRcGmVhz+S9BoRI2FQy6poISe/uqYfzr8IbGdKaeF1 jYeU/0/o/FTQ4IQEfKdIvDDgCH2qWat4VgHvmkYQspCOT4ns1O4pyfslWVTxJLSvOqcJ WaJ4IdfN1uzrWCs21uLQZKAhCXPXlh9A34QMR75go1XpM+LZUbFvA6Mjx5CxSmy+wIJd DSxAtNNbaBwPJD5aN/Jycr6Jijo6v9qvOUt4g0kkvoXIq9SAYDimw6H8fMByYF9BdxOv czs20VcqINOVNmshqWbaxKMwG7qtfLYJ8ywMgWMSg7QdQ2R6nQuk6gg+2ix4mHpnhRBv 9suQ== X-Forwarded-Encrypted: i=1; AJvYcCWnKsUhiELTnOrWWiNrssDqMrntk6M5Zh2b2RbTIJVJf/iYWiCfxqDKbu7tauzsVjR9YWBJew8sEXs3SO8qvH0utaglNdAbudpfG1mzGgw6x07ApaSqAPBEkm+cyd1jY06muDub X-Gm-Message-State: AOJu0YwNo4WGqjnYkF6dlF3/lt6JQ2i99E0lvTGnfe29FOGQhwIGn41g P900ztK/B4i+d5EG9ErnxScSXFvL76OALEMHiAXSk3Re1b9OkFeK X-Received: by 2002:a19:c207:0:b0:51a:f11c:81db with SMTP id 2adb3069b0e04-5220fe794b0mr1561407e87.30.1715337023305; Fri, 10 May 2024 03:30:23 -0700 (PDT) Received: from localhost (fwdproxy-lla-003.fbsv.net. [2a03:2880:30ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17894eb1sm168791566b.77.2024.05.10.03.30.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 03:30:22 -0700 (PDT) From: Breno Leitao To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: thepacketgeek@gmail.com, Aijay Adams , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next] netconsole: Do not shutdown dynamic configuration if cmdline is invalid Date: Fri, 10 May 2024 03:30:05 -0700 Message-ID: <20240510103005.3001545-1-leitao@debian.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If a user provides an invalid netconsole configuration during boot time (e.g., specifying an invalid ethX interface), netconsole will be entirely disabled. Consequently, the user won't be able to create new entries in /sys/kernel/config/netconsole/ as that directory does not exist. Apart from misconfiguration, another issue arises when ethX is loaded as a module and the netconsole= line in the command line points to ethX, resulting in an obvious failure. This renders netconsole unusable, as /sys/kernel/config/netconsole/ will never appear. This is more annoying since users reconfigure (or just toggle) the configuratin later (see commit 5fbd6cdbe304b ("netconsole: Attach cmdline target to dynamic target")) Create /sys/kernel/config/netconsole/ even if the command line arguments are invalid, so, users can create dynamic entries in netconsole. Reported-by: Aijay Adams Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index d7070dd4fe73..e69bc88c22a0 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -122,6 +122,11 @@ struct netconsole_target { struct netpoll np; }; +static inline bool dynamic_netconsole_enabled(void) +{ + return IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC); +} + #ifdef CONFIG_NETCONSOLE_DYNAMIC static struct configfs_subsystem netconsole_subsys; @@ -1262,6 +1267,8 @@ static int __init init_netconsole(void) while ((target_config = strsep(&input, ";"))) { nt = alloc_param_target(target_config, count); if (IS_ERR(nt)) { + if (dynamic_netconsole_enabled()) + continue; err = PTR_ERR(nt); goto fail; } -- 2.43.0