linux/drivers/net/ethernet/mediatek
Lorenzo Bianconi 80df409e1a net: ethernet: mtk_eth_soc: Fix use-after-free in metadata dst teardown
mtk_free_dev() calls metadata_dst_free() which frees the metadata_dst
with kfree() immediately, bypassing the RCU grace period.
In the RX path, skb_dst_set_noref() sets a non-refcounted pointer from
the skb to the metadata_dst. This function requires RCU read-side
protection and the dst must remain valid until all RCU readers complete.
Since metadata_dst_free() calls kfree() directly, a use-after-free can
occur if any skb still holds a noref pointer to the dst when the driver
tears it down.
Replace metadata_dst_free() with dst_release() which properly goes
through the refcount path: when the refcount drops to zero, it schedules
the actual free via call_rcu_hurry(), ensuring all RCU readers have
completed before the memory is freed.

Fixes: 2d7605a729 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260602-airoha-mtk-metadata-uaf-fix-v1-2-3aaa99d83351@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
History 2026-06-03 19:15:32 -07:00
..
Kconfig net: ethernet: mtk_eth_soc: use generic allocator for SRAM 2025-07-07 18:50:45 -07:00
Makefile net: airoha: Move airoha_eth driver in a dedicated folder 2025-03-04 13:22:08 +01:00
mtk_eth_path.c net: ethernet: mtk_eth_soc: add support for MT7988 internal 2.5G PHY 2025-05-01 18:00:15 -07:00
mtk_eth_soc.c net: ethernet: mtk_eth_soc: Fix use-after-free in metadata dst teardown 2026-06-03 19:15:32 -07:00
mtk_eth_soc.h net: ethernet: mtk_eth_soc: use generic allocator for SRAM 2025-07-07 18:50:45 -07:00
mtk_ppe.c net: ethernet: mtk_eth_soc: initialize PPE per-tag-layer MTU registers 2026-04-12 15:22:58 -07:00
mtk_ppe.h net: ethernet: mtk_eth_soc: initialize PPE per-tag-layer MTU registers 2026-04-12 15:22:58 -07:00
mtk_ppe_debugfs.c net: ethernet: mtk_eth_soc: Use ipv6_addr_{cpu_to_be32,be32_to_cpu} helpers 2024-08-16 10:27:48 -07:00
mtk_ppe_offload.c net: ethernet: mtk_ppe: avoid NULL deref when gmac0 is disabled 2026-03-26 19:01:25 -07:00
mtk_ppe_regs.h net: ethernet: mtk_eth_soc: support per-flow accounting on MT7988 2023-08-03 11:28:37 +02:00
mtk_star_emac.c driver: net: ethernet: mtk_star_emac: fix suspend/resume issue 2025-05-29 12:22:25 +02:00
mtk_wed.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mtk_wed.h net: mediatek: wed: Introduce MT7992 WED support to MT7988 SoC 2025-08-13 17:06:55 -07:00
mtk_wed_debugfs.c net: ethernet: mtk_wed: debugfs: add WED 3.0 debugfs entries 2023-09-19 18:27:56 +02:00
mtk_wed_mcu.c net: ethernet: mtk_wed: Fix NULL vs IS_ERR() bug in mtk_wed_get_memory_region() 2025-07-17 18:37:14 -07:00
mtk_wed_ops.c net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED) 2022-04-06 14:08:49 +01:00
mtk_wed_regs.h net: ethernet: mtk_wed: add wed 3.0 reset support 2023-09-19 18:27:56 +02:00
mtk_wed_wo.c net: introduce page_frag_cache_drain() 2024-03-05 11:38:14 +01:00
mtk_wed_wo.h net: ethernet: mtk_wed: fix path of MT7988 WO firmware 2024-10-30 18:26:24 -07:00