ofproto/bond: Fix a race condition in updating post recirculation rules
authorAndy Zhou <azhou@nicira.com>
Thu, 12 Feb 2015 23:10:28 +0000 (15:10 -0800)
committerAndy Zhou <azhou@nicira.com>
Tue, 17 Feb 2015 22:06:09 +0000 (14:06 -0800)
commita62c715408caec1b8bff1861afaa45d561acab61
tree913adc867e4cb687f133e20335b9db0eaad26f29
parentd74152155e4d7e26e460812994c1fcfac5a9c396
ofproto/bond: Fix a race condition in updating post recirculation rules

When updating post recirc rules, rule management requires calls to
hmap APIs, which requires proper locking to ensure mutual exclsion in
accessing the hmap internal data structure. The locking currently is
missing from the output_normal() xlate path, thus causing
a race condition.

The race condition leads to segfault crash of ovs-vswitchd, with the
following stack trace:

The crash was found by adding and deleting bond interfaces repeatedly
with on-going traffic hitting the bond interfaces.  The same test was
ran over multiple days with this patch to ensure the same crash was
not seen.

The patch added the necessary lock annotation that would have caught
the bug.

Tested-by: Salvatore Cambria <salvatore.cambria@citrix.com>
Reported-by: Salvatore Cambria <salvatore.cambria@citrix.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
AUTHORS
ofproto/bond.c