diff mbox series

[ovs-dev,branch-23.09] northd: Fix NULL pointer deref within build_bfd_table.

Message ID 20240924134001.336592-1-amusil@redhat.com
State Accepted
Headers show
Series [ovs-dev,branch-23.09] northd: Fix NULL pointer deref within build_bfd_table. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil Sept. 24, 2024, 1:40 p.m. UTC
The cb_bt pointer was pointing to different struct and might
have been NULL at this point. Make sure we are using the correct
pointer in the strcmp() and sbrec_bfd_set_chassis_name() call.

At the same time make sure we are actually running all tests that
do require the BFD beacon, as it was skipped in all CI stages. The
OpenBFDD project is not available as rpm, so we need to compile it
from source.

Fixes: 4885e337f929 ("rbac: Only allow relevant chassis to update BFD.")
Signed-off-by: Ales Musil <amusil@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
(cherry picked from commit a55eb4a15f53c8169bd5f558ec2b1af0028e4d83)
---
 northd/northd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/northd/northd.c b/northd/northd.c
index d3ff7629d..6a4f8f222 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -10775,8 +10775,9 @@  build_bfd_table(struct ovsdb_idl_txn *ovnsb_txn,
             }
             build_bfd_update_sb_conf(nb_bt, bfd_e->sb_bt);
             if (op && op->sb && op->sb->chassis &&
-                strcmp(op->sb->chassis->name, sb_bt->chassis_name)) {
-                sbrec_bfd_set_chassis_name(sb_bt, op->sb->chassis->name);
+                strcmp(op->sb->chassis->name, bfd_e->sb_bt->chassis_name)) {
+                sbrec_bfd_set_chassis_name(bfd_e->sb_bt,
+                                           op->sb->chassis->name);
             }
 
             hmap_remove(&sb_only, &bfd_e->hmap_node);