From: Ben Pfaff Date: Thu, 3 Dec 2009 23:14:56 +0000 (-0800) Subject: vswitchd: Avoid segfault when creating a bridge fails. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa33d64a5797e59d61fd3d12257b27b5565fc587;p=openvswitch vswitchd: Avoid segfault when creating a bridge fails. bridge_create() can return a null pointer if creating the bridge fails, so check for that and don't dereference it in that case. Thank to Jeremy Stribling for reporting the problem. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 3028766c..581af96a 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -562,7 +562,9 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) const struct ovsrec_bridge *br_cfg = node->data; if (!shash_find_data(&old_br, br_name)) { br = bridge_create(br_name); - br->cfg = br_cfg; + if (br) { + br->cfg = br_cfg; + } } } shash_destroy(&old_br);