Skip to content

Commit

Permalink
netconsole: Do not shutdown dynamic configuration if cmdline is invalid
Browse files Browse the repository at this point in the history
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 5fbd6cd ("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>
Link: https://lore.kernel.org/r/20240528084225.3215853-1-leitao@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Breno Leitao authored and Jakub Kicinski committed May 30, 2024
1 parent 544a74c commit c339067
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/netconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c339067

Please sign in to comment.