From 40cae6703c5f65b423f57ce1cee28963e2687fd8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 26 May 2010 13:37:57 -0700 Subject: [PATCH] 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 --- ofproto/ofproto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index d8215a85d..7cca951b4 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); -- 2.43.0