op->sb->gateway_chassis[0]->chassis may null in some special cases, need 
to add a check to avoid segment fault.

Signed-off-by: wang qianyu <[email protected]>
---
 ovn/northd/ovn-northd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 49e4ac3..9dd159d 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1887,8 +1887,10 @@ ovn_port_update_sbrec(struct northd_context *ctx,
                     /* If we found the chassis, and the gw chassis on 
record
                      * differs from what we expect go ahead and update */
                     if (op->sb->n_gateway_chassis != 1
-                        || 
strcmp(op->sb->gateway_chassis[0]->chassis->name,
-                                  chassis->name)
+                        || !op->sb->gateway_chassis[0]->chassis
+                        || (op->sb->gateway_chassis[0]->chassis &&
+ strcmp(op->sb->gateway_chassis[0]->chassis->name,
+                                  chassis->name))
                         || op->sb->gateway_chassis[0]->priority != 0) {
                         /* Construct a single Gateway_Chassis entry on 
the
                          * Port_Binding attached to the redirect_chassis
-- 
1.8.3.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to