diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-02 16:27:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-02 16:27:41 -0500 |
commit | 452edd598f60522c11f7f88fdbab27eb36509d1a (patch) | |
tree | df1510e9848e591a412c8bfa724253470c48c4c2 /net/ipv6/icmp.c | |
parent | 3872b284087081ee5cb0e4630954c2f7a2153cf5 (diff) |
xfrm: Return dst directly from xfrm_lookup()
Instead of on the stack.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r-- | net/ipv6/icmp.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index e332bae104ee..55665956b3a8 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -324,17 +324,15 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk | |||
324 | /* No need to clone since we're just using its address. */ | 324 | /* No need to clone since we're just using its address. */ |
325 | dst2 = dst; | 325 | dst2 = dst; |
326 | 326 | ||
327 | err = xfrm_lookup(net, &dst, fl, sk, 0); | 327 | dst = xfrm_lookup(net, dst, fl, sk, 0); |
328 | switch (err) { | 328 | if (!IS_ERR(dst)) { |
329 | case 0: | ||
330 | if (dst != dst2) | 329 | if (dst != dst2) |
331 | return dst; | 330 | return dst; |
332 | break; | 331 | } else { |
333 | case -EPERM: | 332 | if (PTR_ERR(dst) == -EPERM) |
334 | dst = NULL; | 333 | dst = NULL; |
335 | break; | 334 | else |
336 | default: | 335 | return dst; |
337 | return ERR_PTR(err); | ||
338 | } | 336 | } |
339 | 337 | ||
340 | err = xfrm_decode_session_reverse(skb, &fl2, AF_INET6); | 338 | err = xfrm_decode_session_reverse(skb, &fl2, AF_INET6); |
@@ -345,17 +343,17 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk | |||
345 | if (err) | 343 | if (err) |
346 | goto relookup_failed; | 344 | goto relookup_failed; |
347 | 345 | ||
348 | err = xfrm_lookup(net, &dst2, &fl2, sk, XFRM_LOOKUP_ICMP); | 346 | dst2 = xfrm_lookup(net, dst2, &fl2, sk, XFRM_LOOKUP_ICMP); |
349 | switch (err) { | 347 | if (!IS_ERR(dst2)) { |
350 | case 0: | ||
351 | dst_release(dst); | 348 | dst_release(dst); |
352 | dst = dst2; | 349 | dst = dst2; |
353 | break; | 350 | } else { |
354 | case -EPERM: | 351 | err = PTR_ERR(dst2); |
355 | dst_release(dst); | 352 | if (err == -EPERM) { |
356 | return ERR_PTR(err); | 353 | dst_release(dst); |
357 | default: | 354 | return dst2; |
358 | goto relookup_failed; | 355 | } else |
356 | goto relookup_failed; | ||
359 | } | 357 | } |
360 | 358 | ||
361 | relookup_failed: | 359 | relookup_failed: |
@@ -560,7 +558,8 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
560 | err = ip6_dst_lookup(sk, &dst, &fl); | 558 | err = ip6_dst_lookup(sk, &dst, &fl); |
561 | if (err) | 559 | if (err) |
562 | goto out; | 560 | goto out; |
563 | if ((err = xfrm_lookup(net, &dst, &fl, sk, 0)) < 0) | 561 | dst = xfrm_lookup(net, dst, &fl, sk, 0); |
562 | if (IS_ERR(dst)) | ||
564 | goto out; | 563 | goto out; |
565 | 564 | ||
566 | if (ipv6_addr_is_multicast(&fl.fl6_dst)) | 565 | if (ipv6_addr_is_multicast(&fl.fl6_dst)) |