aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2015-12-09 17:07:39 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-11 23:31:31 -0500
commit2f3ab9f9fc23811188b9d07d86e4d99ffee887f4 (patch)
tree57c83030fab36fecf1185fab29a9048b87178d95 /net/openvswitch
parent651df2183543bc92f5dbcf99cd9e236ead0bc4c5 (diff)
openvswitch: Fix helper reference leak
If the actions (re)allocation fails, or the actions list is larger than the maximum size, and the conntrack action is the last action when these problems are hit, then references to helper modules may be leaked. Fix the issue. Fixes: cae3a2627520 ("openvswitch: Allow attaching helpers to ct action") Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/conntrack.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index c2cc11168fd5..585a5aa81f89 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -53,6 +53,8 @@ struct ovs_conntrack_info {
53 struct md_labels labels; 53 struct md_labels labels;
54}; 54};
55 55
56static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info);
57
56static u16 key_to_nfproto(const struct sw_flow_key *key) 58static u16 key_to_nfproto(const struct sw_flow_key *key)
57{ 59{
58 switch (ntohs(key->eth.type)) { 60 switch (ntohs(key->eth.type)) {
@@ -708,7 +710,7 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr,
708 nf_conntrack_get(&ct_info.ct->ct_general); 710 nf_conntrack_get(&ct_info.ct->ct_general);
709 return 0; 711 return 0;
710err_free_ct: 712err_free_ct:
711 nf_conntrack_free(ct_info.ct); 713 __ovs_ct_free_action(&ct_info);
712 return err; 714 return err;
713} 715}
714 716
@@ -750,6 +752,11 @@ void ovs_ct_free_action(const struct nlattr *a)
750{ 752{
751 struct ovs_conntrack_info *ct_info = nla_data(a); 753 struct ovs_conntrack_info *ct_info = nla_data(a);
752 754
755 __ovs_ct_free_action(ct_info);
756}
757
758static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info)
759{
753 if (ct_info->helper) 760 if (ct_info->helper)
754 module_put(ct_info->helper->me); 761 module_put(ct_info->helper->me);
755 if (ct_info->ct) 762 if (ct_info->ct)