summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2015-12-10 01:07:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-23 07:55:46 +0300
commit09a44c49189b5fde2e4669e7ee01df5afe703351 (patch)
tree6e342a2f589ca4305a3f5f66170ca6c5043a0625 /net
parentb3e4752dcd6171498f2413274c537ec1bfea9498 (diff)
downloadlinux-09a44c49189b5fde2e4669e7ee01df5afe703351.tar.xz
openvswitch: Fix helper reference leak
[ Upstream commit 2f3ab9f9fc23811188b9d07d86e4d99ffee887f4 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-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 50095820edb7..a808b0fe13e4 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -53,6 +53,8 @@ struct ovs_conntrack_info {
struct md_labels labels;
};
+static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info);
+
static u16 key_to_nfproto(const struct sw_flow_key *key)
{
switch (ntohs(key->eth.type)) {
@@ -708,7 +710,7 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr,
nf_conntrack_get(&ct_info.ct->ct_general);
return 0;
err_free_ct:
- nf_conntrack_free(ct_info.ct);
+ __ovs_ct_free_action(&ct_info);
return err;
}
@@ -750,6 +752,11 @@ void ovs_ct_free_action(const struct nlattr *a)
{
struct ovs_conntrack_info *ct_info = nla_data(a);
+ __ovs_ct_free_action(ct_info);
+}
+
+static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info)
+{
if (ct_info->helper)
module_put(ct_info->helper->me);
if (ct_info->ct)