diff options
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r-- | net/openvswitch/datapath.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e87a26506dba..6980c3e6f066 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -394,6 +394,7 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex, | |||
394 | 394 | ||
395 | skb_copy_and_csum_dev(skb, nla_data(nla)); | 395 | skb_copy_and_csum_dev(skb, nla_data(nla)); |
396 | 396 | ||
397 | genlmsg_end(user_skb, upcall); | ||
397 | err = genlmsg_unicast(net, user_skb, upcall_info->portid); | 398 | err = genlmsg_unicast(net, user_skb, upcall_info->portid); |
398 | 399 | ||
399 | out: | 400 | out: |
@@ -1592,10 +1593,8 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid, | |||
1592 | return ERR_PTR(-ENOMEM); | 1593 | return ERR_PTR(-ENOMEM); |
1593 | 1594 | ||
1594 | retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); | 1595 | retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); |
1595 | if (retval < 0) { | 1596 | BUG_ON(retval < 0); |
1596 | kfree_skb(skb); | 1597 | |
1597 | return ERR_PTR(retval); | ||
1598 | } | ||
1599 | return skb; | 1598 | return skb; |
1600 | } | 1599 | } |
1601 | 1600 | ||
@@ -1690,6 +1689,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info) | |||
1690 | if (IS_ERR(vport)) | 1689 | if (IS_ERR(vport)) |
1691 | goto exit_unlock; | 1690 | goto exit_unlock; |
1692 | 1691 | ||
1692 | err = 0; | ||
1693 | reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, | 1693 | reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, |
1694 | OVS_VPORT_CMD_NEW); | 1694 | OVS_VPORT_CMD_NEW); |
1695 | if (IS_ERR(reply)) { | 1695 | if (IS_ERR(reply)) { |
@@ -1724,24 +1724,32 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) | |||
1724 | nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) | 1724 | nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) |
1725 | err = -EINVAL; | 1725 | err = -EINVAL; |
1726 | 1726 | ||
1727 | reply = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | ||
1728 | if (!reply) { | ||
1729 | err = -ENOMEM; | ||
1730 | goto exit_unlock; | ||
1731 | } | ||
1732 | |||
1727 | if (!err && a[OVS_VPORT_ATTR_OPTIONS]) | 1733 | if (!err && a[OVS_VPORT_ATTR_OPTIONS]) |
1728 | err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]); | 1734 | err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]); |
1729 | if (err) | 1735 | if (err) |
1730 | goto exit_unlock; | 1736 | goto exit_free; |
1737 | |||
1731 | if (a[OVS_VPORT_ATTR_UPCALL_PID]) | 1738 | if (a[OVS_VPORT_ATTR_UPCALL_PID]) |
1732 | vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]); | 1739 | vport->upcall_portid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]); |
1733 | 1740 | ||
1734 | reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, | 1741 | err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid, |
1735 | OVS_VPORT_CMD_NEW); | 1742 | info->snd_seq, 0, OVS_VPORT_CMD_NEW); |
1736 | if (IS_ERR(reply)) { | 1743 | BUG_ON(err < 0); |
1737 | netlink_set_err(sock_net(skb->sk)->genl_sock, 0, | ||
1738 | ovs_dp_vport_multicast_group.id, PTR_ERR(reply)); | ||
1739 | goto exit_unlock; | ||
1740 | } | ||
1741 | 1744 | ||
1742 | genl_notify(reply, genl_info_net(info), info->snd_portid, | 1745 | genl_notify(reply, genl_info_net(info), info->snd_portid, |
1743 | ovs_dp_vport_multicast_group.id, info->nlhdr, GFP_KERNEL); | 1746 | ovs_dp_vport_multicast_group.id, info->nlhdr, GFP_KERNEL); |
1744 | 1747 | ||
1748 | rtnl_unlock(); | ||
1749 | return 0; | ||
1750 | |||
1751 | exit_free: | ||
1752 | kfree_skb(reply); | ||
1745 | exit_unlock: | 1753 | exit_unlock: |
1746 | rtnl_unlock(); | 1754 | rtnl_unlock(); |
1747 | return err; | 1755 | return err; |
@@ -1771,6 +1779,7 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info) | |||
1771 | if (IS_ERR(reply)) | 1779 | if (IS_ERR(reply)) |
1772 | goto exit_unlock; | 1780 | goto exit_unlock; |
1773 | 1781 | ||
1782 | err = 0; | ||
1774 | ovs_dp_detach_port(vport); | 1783 | ovs_dp_detach_port(vport); |
1775 | 1784 | ||
1776 | genl_notify(reply, genl_info_net(info), info->snd_portid, | 1785 | genl_notify(reply, genl_info_net(info), info->snd_portid, |