* [PATCH] netfilter: ipv6: fix afinfo->route refcnt leak on error
@ 2011-09-06 18:59 Florian Westphal
0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2011-09-06 18:59 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
Several callers (conntrack_h323, xt_addrtype) assume that the
returned **dst only needs to be released if the function returns 0.
Instead of changing the callers, fix the ipv6 implementation
to behave like the ipv4 version by only providing *dst result
in the success case.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv6/netfilter.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 30fcee4..8992cf6 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -100,9 +100,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,
--
1.7.3.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-06 19:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-06 18:59 [PATCH] netfilter: ipv6: fix afinfo->route refcnt leak on error Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).