ofproto: Avoid null pointer dereference if in_band_create() fails.
authorBen Pfaff <blp@nicira.com>
Wed, 26 May 2010 20:37:57 +0000 (13:37 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 27 May 2010 16:34:42 +0000 (09:34 -0700)
in_band_create() can fail if something goes wrong with the network device
that represents the local port.  In that case update_in_band_remotes()
should not call in_band_set_remotes(), but it did anyway.  This commit fixes
it.

Reported-by: Tom Everman <teverman@google.com>
ofproto/ofproto.c

index d8215a8..7cca951 100644 (file)
@@ -573,7 +573,9 @@ update_in_band_remotes(struct ofproto *ofproto)
             in_band_create(ofproto, ofproto->dpif, ofproto->switch_status,
                            &ofproto->in_band);
         }
-        in_band_set_remotes(ofproto->in_band, addrs, n_addrs);
+        if (ofproto->in_band) {
+            in_band_set_remotes(ofproto->in_band, addrs, n_addrs);
+        }
         ofproto->next_in_band_update = time_msec() + 1000;
     } else {
         in_band_destroy(ofproto->in_band);