Commit c5d72811 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents f3284e01 8a574f86
...@@ -905,7 +905,10 @@ static struct sk_buff *ovs_flow_cmd_build_info(const struct sw_flow *flow, ...@@ -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, retval = ovs_flow_cmd_fill_info(flow, dp_ifindex, skb,
info->snd_portid, info->snd_seq, 0, info->snd_portid, info->snd_seq, 0,
cmd, ufid_flags); cmd, ufid_flags);
BUG_ON(retval < 0); if (WARN_ON_ONCE(retval < 0)) {
kfree_skb(skb);
skb = ERR_PTR(retval);
}
return skb; return skb;
} }
...@@ -1369,7 +1372,10 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) ...@@ -1369,7 +1372,10 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
OVS_FLOW_CMD_DEL, OVS_FLOW_CMD_DEL,
ufid_flags); ufid_flags);
rcu_read_unlock(); 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); ovs_notify(&dp_flow_genl_family, reply, info);
} else { } else {
...@@ -1377,6 +1383,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info) ...@@ -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); ovs_flow_free(flow, true);
return 0; return 0;
unlock: unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment