CVE-2026-74543: net: udp_tunnel: fix memory leak in udp_tunnel_nic_unregister()

Greg Kroah-Hartman <[email protected]>
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026081549-CVE-2026-74543-8822@gregkh>
From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

net: udp_tunnel: fix memory leak in udp_tunnel_nic_unregister()

syzbot reported a memory leak [1] in the UDP tunnel NIC offload code.

When device registration fails (e.g. in register_netdevice()), netdev core
unwinds by sending a single NETDEV_UNREGISTER notification. If work was queued
during NETDEV_REGISTER (utn->work_pending is set), udp_tunnel_nic_unregister()
returns early:

	if (utn->work_pending)
		return;

Because failed registrations do not enter netdev_wait_allrefs_any(), no
subsequent NETDEV_UNREGISTER rebroadcast will ever occur. As a result, the
struct udp_tunnel_nic allocated in udp_tunnel_nic_alloc() is leaked
permanently.

Fix this by removing the early return. Instead, synchronously cancel any
pending work with cancel_delayed_work_sync() before freeing @utn.

To be able to call cancel_delayed_work_sync() while holding RTNL (the work also
needs RTNL), switch udp_tunnel_nic_device_sync_work() to rtnl_trylock(). If RTNL
is contended, requeue the work with a 1 jiffy delay (via queue_delayed_work())
to prevent high CPU contention while waiting for RTNL lock.

The utn->work_pending bookkeeping is no longer needed and is removed, as
the workqueue core already tracks the pending/running state of the work.

[1]
BUG: memory leak
unreferenced object 0xffff888127d5f840 (size 96):
  comm "syz-executor", pid 5806, jiffies 4294942188
  backtrace (crc 99fdb6c8):
    __kmalloc_noprof+0x3bf/0x550
    udp_tunnel_nic_alloc net/ipv4/udp_tunnel_nic.c:756 [inline]
    udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:833 [inline]
    udp_tunnel_nic_netdevice_event+0x804/0xab0 net/ipv4/udp_tunnel_nic.c:931
    notifier_call_chain+0x59/0x160 kernel/notifier.c:85
    call_netdevice_notifiers_info+0x7d/0xb0 net/core/dev.c:2250
    register_netdevice+0xc10/0xeb0 net/core/dev.c:11478

The Linux kernel CVE team has assigned CVE-2026-74543 to this issue.


Affected and fixed versions
===========================

	Issue introduced in 5.9 with commit cc4e3835eff474aa274d6e1d18f69d9d296d3b76 and fixed in 6.12.103 with commit b712da45bd9b9835d132e9fbc0c3e43c164cb1fd
	Issue introduced in 5.9 with commit cc4e3835eff474aa274d6e1d18f69d9d296d3b76 and fixed in 6.18.44 with commit f82a2ded3d7a9098267c84f14eafdb98c4550ac5
	Issue introduced in 5.9 with commit cc4e3835eff474aa274d6e1d18f69d9d296d3b76 and fixed in 7.1.8 with commit b322532a4b774db1b480a2de84125910a70739a5
	Issue introduced in 5.9 with commit cc4e3835eff474aa274d6e1d18f69d9d296d3b76 and fixed in 7.2-rc6 with commit 080695e6f005e2396f1207fd69d24c442cb230c6

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2026-74543
will be updated if fixes are backported, please check that for the most
up to date information about this issue.


Affected files
==============

The file(s) affected by this issue are:
	net/ipv4/udp_tunnel_nic.c


Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/b712da45bd9b9835d132e9fbc0c3e43c164cb1fd
	https://git.kernel.org/stable/c/f82a2ded3d7a9098267c84f14eafdb98c4550ac5
	https://git.kernel.org/stable/c/b322532a4b774db1b480a2de84125910a70739a5
	https://git.kernel.org/stable/c/080695e6f005e2396f1207fd69d24c442cb230c6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.