[PATCH 5.4 072/102] net: openvswitch: dont unlock mutex when changing the user_features fails
From: Greg Kroah-Hartman
Date: Fri Jan 24 2020 - 04:41:24 EST
From: Tonghao Zhang <xiangxia.m.yue@xxxxxxxxx>
[ Upstream commit 4c76bf696a608ea5cc555fe97ec59a9033236604 ]
Unlocking of a not locked mutex is not allowed.
Other kernel thread may be in critical section while
we unlock it because of setting user_feature fail.
Fixes: 95a7233c4 ("net: openvswitch: Set OvS recirc_id from tc chain index")
Cc: Paul Blakey <paulb@xxxxxxxxxxxx>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@xxxxxxxxx>
Tested-by: Greg Rose <gvrose8192@xxxxxxxxx>
Acked-by: William Tu <u9012063@xxxxxxxxx>
Acked-by: Pravin B Shelar <pshelar@xxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
net/openvswitch/datapath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 23f67b8fdeaae..3eed90bfa2bff 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1667,6 +1667,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
ovs_dp_reset_user_features(skb, info);
}
+ ovs_unlock();
goto err_destroy_meters;
}
@@ -1683,7 +1684,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
return 0;
err_destroy_meters:
- ovs_unlock();
ovs_meters_exit(dp);
err_destroy_ports_array:
kfree(dp->ports);
--
2.20.1