After commit 06e2c1bf0 ("northd: I-P for logical switch creation/deletion
in en_northd.") and commit cef4ef0cd6 ("northd: Creation and deletion of
routers in en-northd engine node.") ovn_datapath pointer in
ovn_datapaths dps vector can be NULL at any given position.
Fix a possible NULL pointer dereference issue in
ovn_sb_insert_or_update_logical_dp_group checking ovn_datapath pointer.

Fixes: 06e2c1bf0ce7 ("northd: I-P for logical switch creation/deletion in 
en_northd.")
Fixes: cef4ef0cd680 ("northd: Creation and deletion of routers in en-northd 
engine node.")
Signed-off-by: Lorenzo Bianconi <[email protected]>
---
 northd/lflow-mgr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c
index a942f287b..43dd1d947 100644
--- a/northd/lflow-mgr.c
+++ b/northd/lflow-mgr.c
@@ -1280,7 +1280,9 @@ ovn_sb_insert_or_update_logical_dp_group(
     BITMAP_FOR_EACH_1 (index, ods_size(datapaths), dpg_bitmap) {
         struct ovn_datapath *od = vector_get(&datapaths->dps, index,
                                              struct ovn_datapath *);
-        sb[n++] = od->sdp->sb_dp;
+        if (od) {
+            sb[n++] = od->sdp->sb_dp;
+        }
     }
     if (!dp_group) {
         struct uuid dpg_uuid = uuid_random();
-- 
2.52.0

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

Reply via email to