When the server is leaving the cluster but remains leader, the
raft_find_server() call can return NULL.  Previously this caused a null
dereference.  This commit fixes the problem.

Signed-off-by: Ben Pfaff <[email protected]>
---
 ovsdb/raft.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index b682738a92f6..07884820ed9b 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -3045,8 +3045,10 @@ raft_update_match_index(struct raft *raft, struct 
raft_server *s,
 static void
 raft_update_our_match_index(struct raft *raft, uint64_t min_index)
 {
-    raft_update_match_index(raft, raft_find_server(raft, &raft->sid),
-                            min_index);
+    struct raft_server *server = raft_find_server(raft, &raft->sid);
+    if (server) {
+        raft_update_match_index(raft, server, min_index);
+    }
 }
 
 static void
-- 
2.16.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to