# CVE-2021-47371: nexthop: Fix memory leaks in nexthop notification chain listeners

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.1
- **CVSS:** 7.1 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **CWE:** CWE-400
- **Published:** 2024-05-21T15:03:36.467Z
- **Modified:** 2026-06-17T04:17:18.990Z

## Who should check

- Anyone running Linux \>= 2a014b200bbd973cc96e082a5bc445fe20b50f32, \< 741760fa6252628a3d3afad439b72437d4b123d9; \>= 2a014b200bbd973cc96e082a5bc445fe20b50f32, \< 3106a0847525befe3e22fc723909d1b21eb0d520
- Anyone running Linux 5.11

## Description

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

nexthop: Fix memory leaks in nexthop notification chain listeners

syzkaller discovered memory leaks \[1\] that can be reduced to the
following commands:

 \# ip nexthop add id 1 blackhole
 \# devlink dev reload pci/0000:06:00.0

As part of the reload flow, mlxsw will unregister its netdevs and then
unregister from the nexthop notification chain. Before unregistering
from the notification chain, mlxsw will receive delete notifications for
nexthop objects using netdevs registered by mlxsw or their uppers. mlxsw
will not receive notifications for nexthops using netdevs that are not
dismantled as part of the reload flow. For example, the blackhole
nexthop above that internally uses the loopback netdev as its nexthop
device.

One way to fix this problem is to have listeners flush their nexthop
tables after unregistering from the notification chain. This is
error-prone as evident by this patch and also not symmetric with the
registration path where a listener receives a dump of all the existing
nexthops.

Therefore, fix this problem by replaying delete notifications for the
listener being unregistered. This is symmetric to the registration path
and also consistent with the netdev notification chain.

The above means that unregister\_nexthop\_notifier(), like
register\_nexthop\_notifier(), will have to take RTNL in order to iterate
over the existing nexthops and that any callers of the function cannot
hold RTNL. This is true for mlxsw and netdevsim, but not for the VXLAN
driver. To avoid a deadlock, change the latter to unregister its nexthop
listener without holding RTNL, making it symmetric to the registration
path.

\[1\]
unreferenced object 0xffff88806173d600 (size 512):
  comm "syz-executor.0", pid 1290, jiffies 4295583142 (age 143.507s)
  hex dump (first 32 bytes):
    41 9d 1e 60 80 88 ff ff 08 d6 73 61 80 88 ff ff  A..\`......sa....
    08 d6 73 61 80 88 ff ff 01 00 00 00 00 00 00 00  ..sa............
  backtrace:
    \[\<ffffffff81a6b576\>\] kmemleak\_alloc\_recursive include/linux/kmemleak.h:43 \[inline\]
    \[\<ffffffff81a6b576\>\] slab\_post\_alloc\_hook+0x96/0x490 mm/slab.h:522
    \[\<ffffffff81a716d3\>\] slab\_alloc\_node mm/slub.c:3206 \[inline\]
    \[\<ffffffff81a716d3\>\] slab\_alloc mm/slub.c:3214 \[inline\]
    \[\<ffffffff81a716d3\>\] kmem\_cache\_alloc\_trace+0x163/0x370 mm/slub.c:3231
    \[\<ffffffff82e8681a\>\] kmalloc include/linux/slab.h:591 \[inline\]
    \[\<ffffffff82e8681a\>\] kzalloc include/linux/slab.h:721 \[inline\]
    \[\<ffffffff82e8681a\>\] mlxsw\_sp\_nexthop\_obj\_group\_create drivers/net/ethernet/mellanox/mlxsw/spectrum\_router.c:4918 \[inline\]
    \[\<ffffffff82e8681a\>\] mlxsw\_sp\_nexthop\_obj\_new drivers/net/ethernet/mellanox/mlxsw/spectrum\_router.c:5054 \[inline\]
    \[\<ffffffff82e8681a\>\] mlxsw\_sp\_nexthop\_obj\_event+0x59a/0x2910 drivers/net/ethernet/mellanox/mlxsw/spectrum\_router.c:5239
    \[\<ffffffff813ef67d\>\] notifier\_call\_chain+0xbd/0x210 kernel/notifier.c:83
    \[\<ffffffff813f0662\>\] blocking\_notifier\_call\_chain kernel/notifier.c:318 \[inline\]
    \[\<ffffffff813f0662\>\] blocking\_notifier\_call\_chain+0x72/0xa0 kernel/notifier.c:306
    \[\<ffffffff8384b9c6\>\] call\_nexthop\_notifiers+0x156/0x310 net/ipv4/nexthop.c:244
    \[\<ffffffff83852bd8\>\] insert\_nexthop net/ipv4/nexthop.c:2336 \[inline\]
    \[\<ffffffff83852bd8\>\] nexthop\_add net/ipv4/nexthop.c:2644 \[inline\]
    \[\<ffffffff83852bd8\>\] rtm\_new\_nexthop+0x14e8/0x4d10 net/ipv4/nexthop.c:2913
    \[\<ffffffff833e9a78\>\] rtnetlink\_rcv\_msg+0x448/0xbf0 net/core/rtnetlink.c:5572
    \[\<ffffffff83608703\>\] netlink\_rcv\_skb+0x173/0x480 net/netlink/af\_netlink.c:2504
    \[\<ffffffff833de032\>\] rtnetlink\_rcv+0x22/0x30 net/core/rtnetlink.c:5590
    \[\<ffffffff836069de\>\] netlink\_unicast\_kernel net/netlink/af\_netlink.c:1314 \[inline\]
    \[\<ffffffff836069de\>\] netlink\_unicast+0x5ae/0x7f0 net/netlink/af\_netlink.c:1340
    \[\<ffffffff83607501\>\] netlink\_sendmsg+0x8e1/0xe30 net/netlink/af\_netlink.c:1929
    \[\<ffffffff832fde84\>\] sock\_sendmsg\_nosec net/socket.c:704 \[inline
---truncated---

## Affected and fixed versions

- Linux: \>= 2a014b200bbd973cc96e082a5bc445fe20b50f32, \< 741760fa6252628a3d3afad439b72437d4b123d9; \>= 2a014b200bbd973cc96e082a5bc445fe20b50f32, \< 3106a0847525befe3e22fc723909d1b21eb0d520 (cvelist)
- Linux: 5.11 (cvelist)

## Mitigation

- Upgrade Linux to 3106a0847525befe3e22fc723909d1b21eb0d520 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47371. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47371.md
Affected: Linux >= 2a014b200bbd973cc96e082a5bc445fe20b50f32, < 741760fa6252628a3d3afad439b72437d4b123d9; >= 2a014b200bbd973cc96e082a5bc445fe20b50f32, < 3106a0847525befe3e22fc723909d1b21eb0d520; Linux 5.11
Fixed in: Linux 741760fa6252628a3d3afad439b72437d4b123d9, Linux 3106a0847525befe3e22fc723909d1b21eb0d520

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47371 being exploited?

There is no confirmed exploitation: CVE-2021-47371 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.28% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-47371?

High: CVSS 7.1 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2021-47371?

Linux \>= 2a014b200bbd973cc96e082a5bc445fe20b50f32, \< 741760fa6252628a3d3afad439b72437d4b123d9; \>= 2a014b200bbd973cc96e082a5bc445fe20b50f32, \< 3106a0847525befe3e22fc723909d1b21eb0d520; Linux 5.11.

### Is there a fix for CVE-2021-47371?

Yes. Fixed in Linux 741760fa6252628a3d3afad439b72437d4b123d9, Linux 3106a0847525befe3e22fc723909d1b21eb0d520. Upgrade Linux to 3106a0847525befe3e22fc723909d1b21eb0d520 or later.

### How do I check if I'm affected by CVE-2021-47371?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/741760fa6252628a3d3afad439b72437d4b123d9>
- patch: <https://git.kernel.org/stable/c/3106a0847525befe3e22fc723909d1b21eb0d520>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47371>

HTML: <https://flawdb.com/CVE-2021-47371> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47371>
