netdev-vport: Fix use-after-free error in netdev_vport_route_changed().
authorBen Pfaff <blp@nicira.com>
Tue, 24 Jun 2014 20:47:33 +0000 (13:47 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 24 Jun 2014 21:41:07 +0000 (14:41 -0700)
We can't unlock the netdev's mutex after close the netdev, because closing
the netdev might destroy the mutex.

VMware-BZ: #1275187
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/netdev-vport.c

index c214bf7..a676784 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -198,8 +198,9 @@ netdev_vport_route_changed(void)
                 netdev_change_seq_changed(netdev_);
             }
         }
-        netdev_close(netdev_);
         ovs_mutex_unlock(&netdev->mutex);
+
+        netdev_close(netdev_);
     }
 
     free(vports);