]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
netfilter: require Ethernet MAC header before using eth_hdr()
authorZhengchuan Liang <zcliangcn@gmail.com>
Sat, 4 Apr 2026 09:39:48 +0000 (17:39 +0800)
committerFlorian Westphal <fw@strlen.de>
Fri, 10 Apr 2026 10:16:27 +0000 (12:16 +0200)
commit62443dc21114c0bbc476fa62973db89743f2f137
tree66e6844ea383b101aaec9e64d94f18284967b83c
parent1dfd95bdf4d18d263aa8fad06bfb9f4d9c992b18
netfilter: require Ethernet MAC header before using eth_hdr()

`ip6t_eui64`, `xt_mac`, the `bitmap:ip,mac`, `hash:ip,mac`, and
`hash:mac` ipset types, and `nf_log_syslog` access `eth_hdr(skb)`
after either assuming that the skb is associated with an Ethernet
device or checking only that the `ETH_HLEN` bytes at
`skb_mac_header(skb)` lie between `skb->head` and `skb->data`.

Make these paths first verify that the skb is associated with an
Ethernet device, that the MAC header was set, and that it spans at
least a full Ethernet header before accessing `eth_hdr(skb)`.

Suggested-by: Florian Westphal <fw@strlen.de>
Tested-by: Ren Wei <enjou1224z@gmail.com>
Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/ipv6/netfilter/ip6t_eui64.c
net/netfilter/ipset/ip_set_bitmap_ipmac.c
net/netfilter/ipset/ip_set_hash_ipmac.c
net/netfilter/ipset/ip_set_hash_mac.c
net/netfilter/nf_log_syslog.c
net/netfilter/xt_mac.c