bridge: Fix null pointer dereference.
authorBen Pfaff <blp@nicira.com>
Fri, 1 Jul 2011 17:13:35 +0000 (10:13 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 1 Jul 2011 17:14:04 +0000 (10:14 -0700)
If the netdev_open() fails then iface->netdev will be NULL and
iface_refresh_stats() will cause a null pointer dereference in
netdev_get_stats().

Fixes a problem introduced by commit 1101a0b47 "bridge: Populate interface
status/statistics as soon as a port is added."

Reported-by: Aaron Rosen <arosen@clemson.edu>
vswitchd/bridge.c

index 935440323bae031ab4b59ddea506e5337cd91f1a..446f4fc0c0516989e5516b7bb013c64f6a1f7dcd 100644 (file)
@@ -869,7 +869,7 @@ bridge_add_ofproto_ports(struct bridge *br)
             }
 
             /* Populate stats columns in new Interface rows. */
-            if (!iface->cfg->mtu) {
+            if (iface->netdev && !iface->cfg->mtu) {
                 iface_refresh_stats(iface);
                 iface_refresh_status(iface);
             }