diff options
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 8625fba96db9..bb02038b822b 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -99,12 +99,11 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
99 | if (!xdst->u.rt6.rt6i_idev) | 99 | if (!xdst->u.rt6.rt6i_idev) |
100 | return -ENODEV; | 100 | return -ENODEV; |
101 | 101 | ||
102 | xdst->u.rt6.rt6i_peer = rt->rt6i_peer; | 102 | rt6_transfer_peer(&xdst->u.rt6, rt); |
103 | if (rt->rt6i_peer) | ||
104 | atomic_inc(&rt->rt6i_peer->refcnt); | ||
105 | 103 | ||
106 | /* Sheit... I remember I did this right. Apparently, | 104 | /* Sheit... I remember I did this right. Apparently, |
107 | * it was magically lost, so this code needs audit */ | 105 | * it was magically lost, so this code needs audit */ |
106 | xdst->u.rt6.n = neigh_clone(rt->n); | ||
108 | xdst->u.rt6.rt6i_flags = rt->rt6i_flags & (RTF_ANYCAST | | 107 | xdst->u.rt6.rt6i_flags = rt->rt6i_flags & (RTF_ANYCAST | |
109 | RTF_LOCAL); | 108 | RTF_LOCAL); |
110 | xdst->u.rt6.rt6i_metric = rt->rt6i_metric; | 109 | xdst->u.rt6.rt6i_metric = rt->rt6i_metric; |
@@ -223,8 +222,10 @@ static void xfrm6_dst_destroy(struct dst_entry *dst) | |||
223 | if (likely(xdst->u.rt6.rt6i_idev)) | 222 | if (likely(xdst->u.rt6.rt6i_idev)) |
224 | in6_dev_put(xdst->u.rt6.rt6i_idev); | 223 | in6_dev_put(xdst->u.rt6.rt6i_idev); |
225 | dst_destroy_metrics_generic(dst); | 224 | dst_destroy_metrics_generic(dst); |
226 | if (likely(xdst->u.rt6.rt6i_peer)) | 225 | if (rt6_has_peer(&xdst->u.rt6)) { |
227 | inet_putpeer(xdst->u.rt6.rt6i_peer); | 226 | struct inet_peer *peer = rt6_peer_ptr(&xdst->u.rt6); |
227 | inet_putpeer(peer); | ||
228 | } | ||
228 | xfrm_dst_destroy(xdst); | 229 | xfrm_dst_destroy(xdst); |
229 | } | 230 | } |
230 | 231 | ||