Skip to content

Commit 00ea1ce

Browse files
wdebruijdavem330
authored andcommitted
ipv6: release dst on error in ip6_dst_lookup_tail
If ip6_dst_lookup_tail has acquired a dst and fails the IPv4-mapped check, release the dst before returning an error. Fixes: ec5e3b0 ("ipv6: Inhibit IPv4-mapped src address on the wire.") Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2763f92 commit 00ea1ce

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/ipv6/ip6_output.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,10 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk,
10221022
}
10231023
#endif
10241024
if (ipv6_addr_v4mapped(&fl6->saddr) &&
1025-
!(ipv6_addr_v4mapped(&fl6->daddr) || ipv6_addr_any(&fl6->daddr)))
1026-
return -EAFNOSUPPORT;
1025+
!(ipv6_addr_v4mapped(&fl6->daddr) || ipv6_addr_any(&fl6->daddr))) {
1026+
err = -EAFNOSUPPORT;
1027+
goto out_err_release;
1028+
}
10271029

10281030
return 0;
10291031

0 commit comments

Comments
 (0)