lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250910195031.3784748-1-alok.a.tiwari@oracle.com>
Date: Wed, 10 Sep 2025 12:50:26 -0700
From: Alok Tiwari <alok.a.tiwari@...cle.com>
To: dsahern@...nel.org, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
        netdev@...r.kernel.org
Cc: alok.a.tiwari@...cle.com
Subject: [PATCH v3 net-next] udp_tunnel: use netdev_warn() instead of netdev_WARN()

netdev_WARN() uses WARN/WARN_ON to print a backtrace along with
file and line information. In this case, udp_tunnel_nic_register()
returning an error is just a failed operation, not a kernel bug.

udp_tunnel_nic_register() can fail in two ways:
1. "-EINVAL":
Invalid or inconsistent udp_tunnel_nic_info provided by the driver
(e.g. set_port without a matching unset_port, missing sync_table,
first table with zero entries). These paths already trigger an
internal WARN_ON(), so misuse is caught and logged with a backtrace.

2. "-ENOMEM":
Memory allocation failure (kzalloc() or udp_tunnel_nic_alloc()).
This is a normal runtime error and not a kernel bug.

Since the -EINVAL paths already warn internally(use WARN()), and
-ENOMEM is a routine failure, the notifier should not escalate
with netdev_WARN(). A plain netdev_warn() is sufficient to
report the error.

Replace netdev_WARN() with netdev_warn() accordingly.

Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
Reviewed-by: Simon Horman <horms@...nel.org>
---
v2 -> v3 
added Reviewed-by Simon
Rephrase commit message after Jakub comment and added more context
for removing netdev_WARN wrt udp_tunnel_nic_register
https://lore.kernel.org/all/20250908182809.3e5a9fdf@kernel.org/
v1 -> v2
Modified commit message as discuss with Simon.
https://lore.kernel.org/all/20250903195717.2614214-1-alok.a.tiwari@oracle.com/
---
 net/ipv4/udp_tunnel_nic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c
index ff66db48453c..944b3cf25468 100644
--- a/net/ipv4/udp_tunnel_nic.c
+++ b/net/ipv4/udp_tunnel_nic.c
@@ -930,7 +930,7 @@ udp_tunnel_nic_netdevice_event(struct notifier_block *unused,
 
 		err = udp_tunnel_nic_register(dev);
 		if (err)
-			netdev_WARN(dev, "failed to register for UDP tunnel offloads: %d", err);
+			netdev_warn(dev, "failed to register for UDP tunnel offloads: %d", err);
 		return notifier_from_errno(err);
 	}
 	/* All other events will need the udp_tunnel_nic state */
-- 
2.50.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ