From: Ben Pfaff Date: Wed, 26 May 2010 20:37:57 +0000 (-0700) Subject: ofproto: Avoid null pointer dereference if in_band_create() fails. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40cae6703c5f65b423f57ce1cee28963e2687fd8;p=openvswitch ofproto: Avoid null pointer dereference if in_band_create() fails. 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 --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index d8215a85..7cca951b 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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);