Skip to content

Commit 5ec70fe

Browse files
committed
Merge: erspan: make sure erspan_base_hdr is present in skb->head
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4311 JIRA: https://issues.redhat.com/browse/RHEL-37232 CVE: CVE-2024-35888 Tested: compile only Signed-off-by: Xin Long <lxin@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Hangbin Liu <haliu@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 9ec057b + b483961 commit 5ec70fe

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

net/ipv4/ip_gre.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,13 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
280280
tpi->flags | TUNNEL_NO_KEY,
281281
iph->saddr, iph->daddr, 0);
282282
} else {
283+
if (unlikely(!pskb_may_pull(skb,
284+
gre_hdr_len + sizeof(*ershdr))))
285+
return PACKET_REJECT;
286+
283287
ershdr = (struct erspan_base_hdr *)(skb->data + gre_hdr_len);
284288
ver = ershdr->ver;
289+
iph = ip_hdr(skb);
285290
tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex,
286291
tpi->flags | TUNNEL_KEY,
287292
iph->saddr, iph->daddr, tpi->key);

net/ipv6/ip6_gre.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ static int ip6erspan_rcv(struct sk_buff *skb,
533533
struct ip6_tnl *tunnel;
534534
u8 ver;
535535

536+
if (unlikely(!pskb_may_pull(skb, sizeof(*ershdr))))
537+
return PACKET_REJECT;
538+
536539
ipv6h = ipv6_hdr(skb);
537540
ershdr = (struct erspan_base_hdr *)skb->data;
538541
ver = ershdr->ver;

0 commit comments

Comments
 (0)