ovs-brcompatd: Fix uninitialized br_vlan variable in handle_fdb_query_cmd().
[openvswitch] / datapath / datapath.c
index 826d8991eb2f371b5d17d0ba143d4297057ee64c..d607315edbc23f13c03021be31e976d3ed5f3a20 100644 (file)
@@ -655,7 +655,8 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
        int key_len;
 
        err = -EINVAL;
-       if (!a[ODP_PACKET_ATTR_PACKET] || !a[ODP_PACKET_ATTR_ACTIONS] ||
+       if (!a[ODP_PACKET_ATTR_PACKET] || !a[ODP_PACKET_ATTR_KEY] ||
+           !a[ODP_PACKET_ATTR_ACTIONS] ||
            nla_len(a[ODP_PACKET_ATTR_PACKET]) < ETH_HLEN)
                goto err;
 
@@ -694,6 +695,12 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
                goto err_flow_put;
        flow->tbl_node.hash = flow_hash(&flow->key, key_len);
 
+       err = flow_metadata_from_nlattrs(&flow->key.eth.in_port,
+                                        &flow->key.eth.tun_id,
+                                        a[ODP_PACKET_ATTR_KEY]);
+       if (err)
+               goto err_flow_put;
+
        acts = flow_actions_alloc(a[ODP_PACKET_ATTR_ACTIONS]);
        err = PTR_ERR(acts);
        if (IS_ERR(acts))
@@ -725,6 +732,7 @@ err:
 
 static const struct nla_policy packet_policy[ODP_PACKET_ATTR_MAX + 1] = {
        [ODP_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC },
+       [ODP_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
        [ODP_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
 };
 
@@ -1904,7 +1912,9 @@ static int odp_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
        if (IS_ERR(reply))
                goto exit_unlock;
 
-       err = genlmsg_reply(reply, info);
+       rcu_read_unlock();
+
+       return genlmsg_reply(reply, info);
 
 exit_unlock:
        rcu_read_unlock();