summaryrefslogtreecommitdiffstats
path: root/include/net/lwtunnel.h
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2015-08-18 12:41:13 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-18 22:11:19 -0400
commitdf383e6240ef222703648072dafd2a1ae21b0d2a (patch)
tree6be9fbd2a2836665df49413b97597b528da9c91e /include/net/lwtunnel.h
parentc938a003448063382e0575aee2d381d4cd7aec34 (diff)
lwtunnel: fix memory leak
The built lwtunnel_state struct has to be freed after comparison. Fixes: 571e722676fe3 ("ipv4: support for fib route lwtunnel encap attributes") Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/lwtunnel.h')
-rw-r--r--include/net/lwtunnel.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index e25b60eb262d..34fd8f70c2ca 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -36,6 +36,11 @@ struct lwtunnel_encap_ops {
36}; 36};
37 37
38#ifdef CONFIG_LWTUNNEL 38#ifdef CONFIG_LWTUNNEL
39static inline void lwtstate_free(struct lwtunnel_state *lws)
40{
41 kfree(lws);
42}
43
39static inline struct lwtunnel_state * 44static inline struct lwtunnel_state *
40lwtstate_get(struct lwtunnel_state *lws) 45lwtstate_get(struct lwtunnel_state *lws)
41{ 46{
@@ -51,7 +56,7 @@ static inline void lwtstate_put(struct lwtunnel_state *lws)
51 return; 56 return;
52 57
53 if (atomic_dec_and_test(&lws->refcnt)) 58 if (atomic_dec_and_test(&lws->refcnt))
54 kfree(lws); 59 lwtstate_free(lws);
55} 60}
56 61
57static inline bool lwtunnel_output_redirect(struct lwtunnel_state *lwtstate) 62static inline bool lwtunnel_output_redirect(struct lwtunnel_state *lwtstate)