Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / net / ipv6 / netfilter.c
index 30fcee4..db31561 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/ipv6.h>
 #include <linux/netfilter.h>
 #include <linux/netfilter_ipv6.h>
+#include <linux/export.h>
 #include <net/dst.h>
 #include <net/ipv6.h>
 #include <net/ip6_route.h>
@@ -100,9 +101,16 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst,
                .pinet6 = (struct ipv6_pinfo *) &fake_pinfo,
        };
        const void *sk = strict ? &fake_sk : NULL;
-
-       *dst = ip6_route_output(net, sk, &fl->u.ip6);
-       return (*dst)->error;
+       struct dst_entry *result;
+       int err;
+
+       result = ip6_route_output(net, sk, &fl->u.ip6);
+       err = result->error;
+       if (err)
+               dst_release(result);
+       else
+               *dst = result;
+       return err;
 }
 
 __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,