[ovs-dev] [PATCH 2/2] ofproto: Avoid null pointer dereference if in_band_create() fails.

Ben Pfaff blp at nicira.com
Wed May 26 20:39:52 UTC 2010


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 at google.com>
---
 ofproto/ofproto.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 7b8effd..9b90f72 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -572,7 +572,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);
-- 
1.7.1





More information about the dev mailing list