diff mbox series

[net,v2] netconsole: Do not shutdown dynamic configuration if cmdline is invalid

Message ID 20240528084225.3215853-1-leitao@debian.org (mailing list archive)
State Accepted
Commit c3390677f6258748a91bf37b9bb21eab89f63b42
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] netconsole: Do not shutdown dynamic configuration if cmdline is invalid | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 45 this patch: 45
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang fail Errors and warnings before: 36 this patch: 36
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 45 this patch: 45
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Breno Leitao May 28, 2024, 8:42 a.m. UTC
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 <aijay@meta.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changelog:

v2:
 * Use IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC) directly instead of a
   external function to check if dynamic reconfiguration is enabled.

---
 drivers/net/netconsole.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org May 30, 2024, 12:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 28 May 2024 01:42:24 -0700 you wrote:
> 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"))
> 
> [...]

Here is the summary with links:
  - [net,v2] netconsole: Do not shutdown dynamic configuration if cmdline is invalid
    https://git.kernel.org/netdev/net-next/c/c3390677f625

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index d7070dd4fe73..ab8a0623b1a1 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1262,6 +1262,8 @@  static int __init init_netconsole(void)
 		while ((target_config = strsep(&input, ";"))) {
 			nt = alloc_param_target(target_config, count);
 			if (IS_ERR(nt)) {
+				if (IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC))
+					continue;
 				err = PTR_ERR(nt);
 				goto fail;
 			}