Skip to content

Commit

Permalink
[IPV6]: Fix leak added by udp connect dst caching fix.
Browse files Browse the repository at this point in the history
Based upon a patch from Mitsuru KANDA <mk@linux-ipv6.org>

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 3, 2005
1 parent f36d6ab commit a5e7c21
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,10 +852,16 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
else if (!corkreq)
err = udp_v6_push_pending_frames(sk, up);

if (dst && connected)
ip6_dst_store(sk, dst,
ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ?
&np->daddr : NULL);
if (dst) {
if (connected) {
ip6_dst_store(sk, dst,
ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ?
&np->daddr : NULL);
} else {
dst_release(dst);
}
}

if (err > 0)
err = np->recverr ? net_xmit_errno(err) : 0;
release_sock(sk);
Expand Down

0 comments on commit a5e7c21

Please sign in to comment.