Skip to content

Commit 7aaa8f5

Browse files
edumazetkuba-moo
authored andcommitted
ipv6: fix potential UAF caused by ip6_forward_proxy_check()
ip6_forward_proxy_check() calls pskb_may_pull() which might re-allocate skb->head. Reload ipv6_hdr() after the pskb_may_pull() call to avoid using the freed memory. Fixes: e21e0b5 ("[IPV6] NDISC: Handle NDP messages to proxied addresses.") Reported-by: Damiano Melotti <melotti@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260505130056.2927197-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0e1368a commit 7aaa8f5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/ipv6/ip6_output.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
468468
default:
469469
break;
470470
}
471+
hdr = ipv6_hdr(skb);
471472
}
472473

473474
/*
@@ -582,6 +583,8 @@ int ip6_forward(struct sk_buff *skb)
582583
if (READ_ONCE(net->ipv6.devconf_all->proxy_ndp) &&
583584
pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev)) {
584585
int proxied = ip6_forward_proxy_check(skb);
586+
587+
hdr = ipv6_hdr(skb);
585588
if (proxied > 0) {
586589
/* It's tempting to decrease the hop limit
587590
* here by 1, as we do at the end of the

0 commit comments

Comments
 (0)