Netdev List
 help / color / mirror / Atom feed
* [PATCH v2 net 0/4] vlan: ensure sufficient headroom in vlan_dev_hard_header()
@ 2026-09-24  8:29 Eric Dumazet
  2026-09-24  8:29 ` [PATCH v2 net 1/4] llc: fix skb UAF and leaks on llc_mac_hdr_init() failure Eric Dumazet
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Eric Dumazet @ 2026-09-24  8:29 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, edumazet, Eric Dumazet

Callers that only reserve ETH_HLEN or less, or skbs allocated before
dynamic device/headroom changes (such as toggling VLAN_FLAG_REORDER_HDR
or bonding/team switching slaves), can reach vlan_dev_hard_header() with
insufficient headroom and trigger skb_under_panic().

When vlan_dev_hard_header() returns -ENOMEM upon skb_cow_head() failure,
a few callers of dev_hard_header() / llc_mac_hdr_init() had pre-existing
error-handling bugs:

- Patch 1 fixes a UAF/double-free of skb and leak of nskb in
  llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(), as well as nskb leaks in
  llc_sap_action_send_xid_r() and llc_sap_action_send_test_r() when
  llc_mac_hdr_init() fails.
- Patch 2 checks the return value of llc_mac_hdr_init() in br_send_bpdu()
  and frees the skb on error.
- Patch 3 removes a shadowed 'int err;' variable in __teql_resolve() so
  negative errors from dev_hard_header() are properly returned as -EINVAL.
- Patch 4 uses skb_cow_head() in vlan_dev_hard_header() when
  VLAN_FLAG_REORDER_HDR is not set to ensure sufficient headroom for the
  VLAN header(s) and the underlying device hard header.

v2:
 - Add patches 1-3 to fix pre-existing error handling in llc, bridge, and
   sch_teql when dev_hard_header() fails (Sashiko).
 - Use READ_ONCE() when reading dev->hard_header_len and
   dev->needed_headroom in vlan_dev_hard_header(), and explain why
   LL_RESERVED_SPACE(dev) is not used here (Hangbin Liu, Sashiko).
 - Link to v1: https://lore.kernel.org/netdev/20260922113924.3165190-1-edumazet@google.com/

Eric Dumazet (4):
  llc: fix skb UAF and leaks on llc_mac_hdr_init() failure
  bridge: check llc_mac_hdr_init() return value in br_send_bpdu()
  net/sched: sch_teql: fix shadowed err in __teql_resolve()
  vlan: ensure sufficient headroom in vlan_dev_hard_header()

 net/8021q/vlan_dev.c     | 5 +++++
 net/bridge/br_stp_bpdu.c | 5 ++++-
 net/llc/llc_c_ac.c       | 2 +-
 net/llc/llc_s_ac.c       | 4 ++++
 net/sched/sch_teql.c     | 7 ++-----
 5 files changed, 16 insertions(+), 7 deletions(-)

-- 
2.56.0.rc1.310.g51773c2048-goog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-24 18:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24  8:29 [PATCH v2 net 0/4] vlan: ensure sufficient headroom in vlan_dev_hard_header() Eric Dumazet
2026-09-24  8:29 ` [PATCH v2 net 1/4] llc: fix skb UAF and leaks on llc_mac_hdr_init() failure Eric Dumazet
2026-09-24  8:29 ` [PATCH v2 net 2/4] bridge: check llc_mac_hdr_init() return value in br_send_bpdu() Eric Dumazet
2026-09-24 10:25   ` Nikolay Aleksandrov
2026-09-24  8:29 ` [PATCH v2 net 3/4] net/sched: sch_teql: fix shadowed err in __teql_resolve() Eric Dumazet
2026-09-24  8:29 ` [PATCH v2 net 4/4] vlan: ensure sufficient headroom in vlan_dev_hard_header() Eric Dumazet
2026-09-24 18:10 ` [PATCH v2 net 0/4] " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox