mpls: reload header after pskb_may_pull()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 9f427a0e474a67b454420c131709600d44850486 · < d82b90a38c2ca8a0694428eab0e9551c23f2447d| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mpls: reload header after pskb_may_pull()
mpls_select_multipath() calls mpls_multipath_hash() to choose a nexthop when an MPLS route has multiple nexthops. While walking the MPLS label stack, the hash routine caches hdr for the current label. After finding the bottom-of-stack label, it calls pskb_may_pull() before reading the inner IP header.
If an skb is constructed with the inner IP header in nonlinear data and insufficient tailroom in the linear head, pskb_may_pull() calls pskb_expand_head() to replace the skb head and free the old one. This leaves hdr pointing to freed memory. The IPv6 path can invalidate hdr again when it performs a second pull for the larger header.
The issue was found through static analysis. A reproducer sending a legal Geneve packet through a bareudp/MPLS multipath setup triggered the same KASAN report in 2 of 2 unpatched runs:
BUG: KASAN: slab-use-after-free in mpls_select_multipath Read of size 1 at addr ffff88800ecc6e20 by task ksoftirqd/1/23
Call Trace: mpls_select_multipath mpls_forward __netif_receive_skb_list_core netif_receive_skb_list_internal napi_complete_done gro_cell_poll __napi_poll net_rx_action
Freed by task 23: kfree pskb_expand_head __pskb_pull_tail mpls_select_multipath
From the CVE record · Linux
The Linux kernel's MPLS multipath forwarding code can retain a pointer to freed packet memory after pulling an inner IP header. A network packet with its inner IP header in nonlinear data and insufficient linear-head tailroom can trigger a use-after-free when forwarded through an MPLS multipath setup.
Engineers running Linux kernels with MPLS multipath forwarding should check their deployments; affected versions were not provided.