CVE-2026-23209: macvlan: fix error recovery in macvlan_common_newlink()
In the Linux kernel, the following vulnerability has been resolved:
macvlan: fix error recovery in macvlancommonnewlink()
valis provided a nice repro to crash the kernel:
ip link add p1 type veth peer p2 ip link set address 00:00:00:00:00:20 dev p1 ip link set up dev p1 ip link set up dev p2
ip link add mv0 link p2 type macvlan mode source ip link add invalid% link p2 type macvlan mode source macaddr add 00:00:00:00:00:20
ping -c1 -I p1 1.2.3.4
He also gave a very detailed analysis:
<quote valis>
The issue is triggered when a new macvlan link is created with MACVLANMODESOURCE mode and MACVLANMACADDRADD (or MACVLANMACADDRSET) parameter, lower device already has a macvlan port and registernetdevice() called from macvlancommonnewlink() fails (e.g. because of the invalid link name).
In this case macvlanhashaddsource is called from macvlanchangesources() / macvlancommonnewlink():
This adds a reference to vlan to the port's vlansourcehash using macvlansourceentry.
vlan is a pointer to the priv data of the link that is being created.
When registernetdevice() fails, the error is returned from macvlannewlink() to rtnlnewlinkcreate():
if (ops->newlink) err = ops->newlink(dev, ¶ms, extack); else err = registernetdevice(dev); if (err < 0) { freenetdev(dev); goto out; }
and freenetdev() is called, causing a kvfree() on the struct netdevice that is still referenced in the source entry attached to the lower device's macvlan port.
Now all packets sent on the macvlan port with a matching source mac address will trigger a use-after-free in macvlanforwardsource().
</quote valis>
With all that, my fix is to make sure we call macvlanflushsources() regardless of @create value whenever "goto destroymacvlanport;" path is taken.
Many thanks to valis for following up on this issue.
Other sources
In the Linux kernel, the following vulnerability has been resolved:
macvlan: fix error recovery in macvlancommonnewlink()
valis provided a nice repro to crash the kernel:
ip link add p1 type veth peer p2 ip link set address 00:00:00:00:00:20 dev p1 ip link set up dev p1 ip link set up dev p2
ip link add mv0 link p2 type macvlan mode source ip link add invalid% link p2 type macvlan mode source macaddr add 00:00:00:00:00:20
ping -c1 -I p1 1.2.3.4
He also gave a very detailed analysis:
quote valis
The issue is triggered when a new macvlan link is created with MACVLANMODESOURCE mode and MACVLANMACADDRADD (or MACVLANMACADDRSET) parameter, lower device already has a macvlan port and registernetdevice() called from macvlancommonnewlink() fails (e.g. because of the invalid link name).
In this case macvlanhashaddsource is called from macvlanchangesources() / macvlancommonnewlink():
This adds a reference to vlan to the port's vlansourcehash using macvlansourceentry.
vlan is a pointer to the priv data of the link that is being created.
When registernetdevice() fails, the error is returned from macvlannewlink() to rtnlnewlinkcreate():
if (ops-newlink) err = ops-newlink(dev, ¶ms, extack); else err = registernetdevice(dev); if (err 0) { freenetdev(dev); goto out; }
and freenetdev() is called, causing a kvfree() on the struct netdevice that is still referenced in the source entry attached to the lower device's macvlan port.
Now all packets sent on the macvlan port with a matching source mac address will trigger a use-after-free in macvlanforwardsource().
/quote valis
With all that, my fix is to make sure we call macvlanflushsources() regardless of @create value whenever "goto destroymacvlanport;" path is taken.
Many thanks to valis for following up on this issue.
— IBM
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.251-5Fixed in 6.1.170-3Fixed in 6.1.172-1Fixed in 6.12.86-1Fixed in 6.12.88-1Fixed in 7.0.7-1 - Upgrade
Upgrade
debian/linux-6.1to a version that resolves this vulnerability.Fixed in 6.1.172-1~deb11u1 - Configuration
Apply the macvlan error-recovery fix so that macvlan_flush_sources() is invoked regardless of @create whenever execution takes the 'goto destroy_macvlan_port;' path in macvlan_common_newlink(), preventing a use-after-free in macvlan_forward_source() when register_netdevice() fails.
Linux kernel macvlan macvlan_flush_sources() call during error recovery = call macvlan_flush_sources() regardless of @create when taking path 'goto destroy_macvlan_port;'
Event History
Frequently Asked Questions
What is the severity of CVE-2026-23209?
CVE-2026-23209 has a high severity due to its potential to crash the kernel during error recovery processes.
How do I fix CVE-2026-23209?
Fixing CVE-2026-23209 involves updating to the latest version of the Linux kernel where the vulnerability has been addressed.
What are the consequences of CVE-2026-23209?
The consequences of CVE-2026-23209 include system crashes and possible denial of service due to improper error handling in macvlan.
Which software is affected by CVE-2026-23209?
CVE-2026-23209 affects various versions of the Linux Kernel, particularly those utilizing macvlan functionalities.
Is there a workaround for CVE-2026-23209?
Currently, there is no established workaround for CVE-2026-23209, so updating the kernel is the recommended approach.