fix(ovn): add null check before sbrec delete calls#6316
Conversation
Add a patch for OVN that adds null pointer checks before calling sbrec_port_binding_delete, sbrec_bfd_delete, and sbrec_encap_delete to prevent potential null pointer dereference crashes in northd and ovn-sbctl. Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
Summary of ChangesHello @oilbeater, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the robustness of OVN by addressing potential null pointer dereference issues. By strategically adding null checks in critical deletion functions, it prevents crashes in core components like Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces a new patch to add null pointer checks before sbrec_port_binding_delete, sbrec_bfd_delete, and sbrec_encap_delete calls in OVN. This is a critical improvement to prevent potential null pointer dereference crashes, enhancing the stability of northd and ovn-sbctl. The changes also correctly integrate this new patch into the Dockerfile.base for the OVN build process. The implementation of the null checks is straightforward and directly addresses the identified vulnerability.
| + if (op->sb) { | ||
| + sbrec_port_binding_delete(op->sb); | ||
| + } |
| + if (bfd_e->stale && bfd_e->sb_bt) { | ||
| sbrec_bfd_delete(bfd_e->sb_bt); |
| + if (sbctl_ch->ch_cfg->encaps[i]) { | ||
| + sbrec_encap_delete(sbctl_ch->ch_cfg->encaps[i]); | ||
| + } |
| git apply $SRC_DIR/52b727b3315463668669ff423ce8bfa129861162.patch && \ | ||
| # add null check before sbrec delete calls | ||
| git apply $SRC_DIR/sbrec-delete-null-check.patch |
Pull Request Test Coverage Report for Build 22278762748Details
💛 - Coveralls |
…#6316) Add a patch for OVN that adds null pointer checks before calling sbrec_port_binding_delete, sbrec_bfd_delete, and sbrec_encap_delete to prevent potential null pointer dereference crashes in northd and ovn-sbctl. Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit 5c6e746)
Summary
sbrec_port_binding_delete,sbrec_bfd_delete, andsbrec_encap_deletenorthdandovn-sbctlDockerfile.baseChanges
dist/images/patches/sbrec-delete-null-check.patch: New patch file with null checks in three locations:northd/northd.c: Checkop->sbbeforesbrec_port_binding_deletenorthd/northd.c: Checkbfd_e->sb_btbeforesbrec_bfd_deleteutilities/ovn-sbctl.c: Checksbctl_ch->ch_cfg->encaps[i]beforesbrec_encap_deletedist/images/Dockerfile.base: Add and apply the new patchTest plan
Fix #6053
🤖 Generated with Claude Code