summaryrefslogtreecommitdiff
path: root/drivers/net/netconsole.c
diff options
context:
space:
mode:
authorAndre Carvalho <asantostc@gmail.com>2026-01-18 11:00:24 +0000
committerJakub Kicinski <kuba@kernel.org>2026-01-21 19:09:11 -0800
commit5b114087438dcd229c8754c093c44619c346d67c (patch)
tree76fd7f24df4ed77cd157411aababf40fc44da06d /drivers/net/netconsole.c
parente8f4005ab2d4819805c2f6b19e8bd633f8579bd0 (diff)
downloadlinux-next-5b114087438dcd229c8754c093c44619c346d67c.tar.gz
linux-next-5b114087438dcd229c8754c093c44619c346d67c.zip
netconsole: clear dev_name for devices bound by mac
This patch makes sure netconsole clears dev_name for devices bound by mac in order to allow calling setup_netpoll on targets that have previously been cleaned up (in order to support resuming deactivated targets). This is required as netpoll_setup populates dev_name even when devices are matched via mac address. The cleanup is done inside netconsole as bound by mac is a netconsole concept. Signed-off-by: Andre Carvalho <asantostc@gmail.com> Reviewed-by: Breno Leitao <leitao@debian.org> Tested-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20260118-netcons-retrigger-v11-4-4de36aebcf48@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r--drivers/net/netconsole.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 7a1e5559fc0d..02a3463e8d24 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -242,6 +242,12 @@ static void populate_configfs_item(struct netconsole_target *nt,
}
#endif /* CONFIG_NETCONSOLE_DYNAMIC */
+/* Check if the target was bound by mac address. */
+static bool bound_by_mac(struct netconsole_target *nt)
+{
+ return is_valid_ether_addr(nt->np.dev_mac);
+}
+
/* Allocate and initialize with defaults.
* Note that these targets get their config_item fields zeroed-out.
*/
@@ -284,6 +290,8 @@ static void netconsole_process_cleanups_core(void)
/* all entries in the cleanup_list needs to be disabled */
WARN_ON_ONCE(nt->state == STATE_ENABLED);
do_netpoll_cleanup(&nt->np);
+ if (bound_by_mac(nt))
+ memset(&nt->np.dev_name, 0, IFNAMSIZ);
/* moved the cleaned target to target_list. Need to hold both
* locks
*/