datapath: Destroy internal devices before freeing datapath.
authorJesse Gross <jesse@nicira.com>
Thu, 24 Feb 2011 22:07:29 +0000 (14:07 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 25 Feb 2011 01:20:08 +0000 (17:20 -0800)
commit99620d2c1b01045a652d586da3c46608f7c59eda
tree9eed450953399fdd71abee33c39ce3c029e303ee
parent8338302d5cecb0a082104a8ff09544c2909d4308
datapath: Destroy internal devices before freeing datapath.

When destroying vports we account for two types of synchronization
mechanisms: RTNL and RCU.  However, it is possible to call into
network device methods with just a device reference without either
of these.  These device methods can use the datapath data structures
but we don't wait for all of the references to go away before freeing
the datapath.  The actual wait happens in rtnl_unlock(), so by moving
up that call we can avoid the possibility of use after free with
internal devices.

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