Skip to content

northd, ovn-sbctl: Fix null pointer dereferences in sbrec delete calls.#301

Open
oilbeater wants to merge 1 commit into
ovn-org:mainfrom
oilbeater:fix/sbrec-delete-null-check
Open

northd, ovn-sbctl: Fix null pointer dereferences in sbrec delete calls.#301
oilbeater wants to merge 1 commit into
ovn-org:mainfrom
oilbeater:fix/sbrec-delete-null-check

Conversation

@oilbeater

Copy link
Copy Markdown
Contributor

We experienced some segmentation faults in our end-to-end tests, and with these patches, the segmentation fault has been resolved.

Add missing NULL checks before calling sbrec delete functions to prevent null pointer dereferences:

  • en-sync-sb.c: Add missing 'continue' after free(sb_lb) in sync_changed_lbs() to avoid use-after-free when accessing sb_lb->sbrec_lb in the subsequent sync_sb_lb_record() call.
  • northd.c: Add NULL check for op->sb before calling sbrec_port_binding_delete() in ls_handle_lsp_changes().
  • northd.c: Add NULL check for bfd_e->sb_bt before calling sbrec_bfd_delete() in bfd_table_sync().
  • ovn-sbctl.c: Add NULL check for encaps[i] before calling sbrec_encap_delete() in cmd_chassis_del().

Add missing NULL checks before calling sbrec delete functions to
prevent null pointer dereferences:

- en-sync-sb.c: Add missing 'continue' after free(sb_lb) in
  sync_changed_lbs() to avoid use-after-free when accessing
  sb_lb->sbrec_lb in the subsequent sync_sb_lb_record() call.
- northd.c: Add NULL check for op->sb before calling
  sbrec_port_binding_delete() in ls_handle_lsp_changes().
- northd.c: Add NULL check for bfd_e->sb_bt before calling
  sbrec_bfd_delete() in bfd_table_sync().
- ovn-sbctl.c: Add NULL check for encaps[i] before calling
  sbrec_encap_delete() in cmd_chassis_del().

Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
@almusil

almusil commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

Hi,
thank you for the patch.

We use mailing list to submit patches https://docs.ovn.org/en/latest/internals/contributing/submitting-patches.html.

Each of the changes should be a separate commit with proper Fixes tag that would help us with tracking how far we need to make the backport. Ideally each change would have a test added that will exercise the scenario when the crash occurs to prevent regressions in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants