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

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch

Jesse Gross says:

====================
Two small bug fixes for net/3.9 including the issue previously
discussed where allocation of netlink notifications can fail after
changes have been committed.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 96d86834 d3e1101c
...@@ -1593,10 +1593,8 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid, ...@@ -1593,10 +1593,8 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd);
if (retval < 0) { BUG_ON(retval < 0);
kfree_skb(skb);
return ERR_PTR(retval);
}
return skb; return skb;
} }
...@@ -1726,24 +1724,32 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) ...@@ -1726,24 +1724,32 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type)
err = -EINVAL; err = -EINVAL;
reply = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!reply) {
err = -ENOMEM;
goto exit_unlock;
}
if (!err && a[OVS_VPORT_ATTR_OPTIONS]) if (!err && a[OVS_VPORT_ATTR_OPTIONS])
err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]); err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]);
if (err) if (err)
goto exit_unlock; goto exit_free;
if (a[OVS_VPORT_ATTR_UPCALL_PID]) if (a[OVS_VPORT_ATTR_UPCALL_PID])
vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]); vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]);
reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid,
OVS_VPORT_CMD_NEW); info->snd_seq, 0, OVS_VPORT_CMD_NEW);
if (IS_ERR(reply)) { BUG_ON(err < 0);
netlink_set_err(sock_net(skb->sk)->genl_sock, 0,
ovs_dp_vport_multicast_group.id, PTR_ERR(reply));
goto exit_unlock;
}
genl_notify(reply, genl_info_net(info), info->snd_portid, genl_notify(reply, genl_info_net(info), info->snd_portid,
ovs_dp_vport_multicast_group.id, info->nlhdr, GFP_KERNEL); ovs_dp_vport_multicast_group.id, info->nlhdr, GFP_KERNEL);
rtnl_unlock();
return 0;
exit_free:
kfree_skb(reply);
exit_unlock: exit_unlock:
rtnl_unlock(); rtnl_unlock();
return err; return err;
......
...@@ -795,9 +795,9 @@ void ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow) ...@@ -795,9 +795,9 @@ void ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow)
void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow) void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow)
{ {
BUG_ON(table->count == 0);
hlist_del_rcu(&flow->hash_node[table->node_ver]); hlist_del_rcu(&flow->hash_node[table->node_ver]);
table->count--; table->count--;
BUG_ON(table->count < 0);
} }
/* The size of the argument for each %OVS_KEY_ATTR_* Netlink attribute. */ /* The size of the argument for each %OVS_KEY_ATTR_* Netlink attribute. */
......
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