Skip to content

Commit

Permalink
ofctrl: Fix use of uninitialized hash value in ofctrl_add_flow().
Browse files Browse the repository at this point in the history
When ofctrl_add_flow() called ovn_flow_lookup(), the latter used the hash
from the flow's hmap_node, but the former hadn't initialized it at that
point.  This commit fixes the problem.

Reported-by: Russell Bryant <rbryant@redhat.com>
Reported-at: http://openvswitch.org/pipermail/dev/2015-July/057851.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
  • Loading branch information
blp committed Jul 28, 2015
1 parent 34f3e84 commit adc48a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ovn/controller/ofctrl.c
Expand Up @@ -268,6 +268,7 @@ ofctrl_add_flow(struct hmap *desired_flows,
f->match = *match;
f->ofpacts = xmemdup(actions->data, actions->size);
f->ofpacts_len = actions->size;
f->hmap_node.hash = ovn_flow_hash(f);

if (ovn_flow_lookup(desired_flows, f)) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
Expand All @@ -281,7 +282,7 @@ ofctrl_add_flow(struct hmap *desired_flows,
return;
}

hmap_insert(desired_flows, &f->hmap_node, ovn_flow_hash(f));
hmap_insert(desired_flows, &f->hmap_node, f->hmap_node.hash);
}

/* ovn_flow. */
Expand Down

0 comments on commit adc48a5

Please sign in to comment.