datapath: Fully initialize datapath before local port.
authorJesse Gross <jesse@nicira.com>
Thu, 15 Sep 2011 23:41:36 +0000 (16:41 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 20 Sep 2011 17:47:40 +0000 (10:47 -0700)
commit675cd7211f2336c4e8bb0d0340c5ebd9b98f5219
treec735050a86ca5da72a78a7ab5bdaaf2e43502b8a
parenta09ee517a1239c96d357e2dd9facb3e71deadd9c
datapath: Fully initialize datapath before local port.

It's possible to start receiving packets on a datapath as soon as
the internal device is created.  It's therefore important that the
datapath be fully initialized before this, which it currently isn't.
In particular, the fact that dp->stats_percpu is not yet set is
potentially fatal.  In addition, if allocation of the Netlink response
failed it would leak the percpu memory.  This fixes both problems.

Found by code inspection, in practice the datapath is probably always
done initializing before someone can send a packet on it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/datapath.c
datapath/datapath.h