aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-12-01 13:21:24 -0800
committerDavid S. Miller <davem@davemloft.net>2019-12-01 13:21:24 -0800
commitc5d728113532c695c894c2a88a10453ac83b0f3b (patch)
tree721cdbb01ff7e864a864f31e93ef97cc2cdc6702
parentnet: phy: realtek: fix using paged operations with RTL8105e / RTL8208 (diff)
parentopenvswitch: remove another BUG_ON() (diff)
downloadlinux-dev-c5d728113532c695c894c2a88a10453ac83b0f3b.tar.xz
linux-dev-c5d728113532c695c894c2a88a10453ac83b0f3b.zip
Merge branch 'openvswitch-remove-a-couple-of-BUG_ON'
Paolo Abeni says: ==================== openvswitch: remove a couple of BUG_ON() The openvswitch kernel datapath includes some BUG_ON() statements to check for exceptional/unexpected failures. These patches drop a couple of them, where we can do that without introducing other side effects. v1 -> v2: - avoid memory leaks on error path ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/openvswitch/datapath.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 293d5289c4a1..1047e8043084 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -905,7 +905,10 @@ static struct sk_buff *ovs_flow_cmd_build_info(const struct sw_flow *flow,
retval = ovs_flow_cmd_fill_info(flow, dp_ifindex, skb,
info->snd_portid, info->snd_seq, 0,
cmd, ufid_flags);
- BUG_ON(retval < 0);
+ if (WARN_ON_ONCE(retval < 0)) {
+ kfree_skb(skb);
+ skb = ERR_PTR(retval);
+ }
return skb;
}
@@ -1369,7 +1372,10 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
OVS_FLOW_CMD_DEL,
ufid_flags);
rcu_read_unlock();
- BUG_ON(err < 0);
+ if (WARN_ON_ONCE(err < 0)) {
+ kfree_skb(reply);
+ goto out_free;
+ }
ovs_notify(&dp_flow_genl_family, reply, info);
} else {
@@ -1377,6 +1383,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
}
}
+out_free:
ovs_flow_free(flow, true);
return 0;
unlock: