Skip to content

Commit

Permalink
ofctrl: Fix using uninitialized flow cookie.
Browse files Browse the repository at this point in the history
ovn-controller has uninitialized flow cookie because ofctrl_dup_flow()
doesn't copy it from the original flow while duplicating.  This could
cause redundant flow updates or other issues.

Valgrind reports:

 Conditional jump or move depends on uninitialised value(s)
    at 0x414B1C: ofctrl_put (ofctrl.c:1192)
    by 0x409ACB: main (ovn-controller.c:2086)
  Uninitialised value was created by a heap allocation
    at 0x483980B: malloc (vg_replace_malloc.c:309)
    by 0x4C8474: xmalloc (util.c:138)
    by 0x414553: ofctrl_dup_flow (ofctrl.c:793)
    by 0x4152CD: ofctrl_put (ofctrl.c:1231)
    by 0x409ACB: main (ovn-controller.c:2086)

Fixes: d25e286 ("ovn-controller: Tie OpenFlow and logical flows using OpenFlow cookie.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
igsilya authored and putnopvut committed May 13, 2020
1 parent 88056d1 commit cd0f99c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions controller/ofctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ ofctrl_dup_flow(struct ovn_flow *src)
dst->sb_uuid = src->sb_uuid;
dst->match_hmap_node.hash = src->match_hmap_node.hash;
dst->uuid_hindex_node.hash = uuid_hash(&src->sb_uuid);
dst->cookie = src->cookie;
return dst;
}

Expand Down

0 comments on commit cd0f99c

Please sign in to comment.