Skip to content

fix: prevents nil dereference on UP node removal#199

Merged
Alonza0314 merged 1 commit into
free5gc:mainfrom
DBGR18:fix/905
Mar 25, 2026
Merged

fix: prevents nil dereference on UP node removal#199
Alonza0314 merged 1 commit into
free5gc:mainfrom
DBGR18:fix/905

Conversation

@DBGR18

@DBGR18 DBGR18 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

fix issue#905

This pull request makes a targeted improvement to the DeleteUpNodeLink handler to ensure that the CancelAssociation method is only called on valid UPF nodes. Specifically, it adds a check to confirm that the UPF field is not nil before invoking CancelAssociation, and moves the call to occur only when the node type is UPNODE_UPF and a valid UPF exists.

Node deletion logic improvements:

  • Updated the conditional in DeleteUpNodeLink to call CancelAssociation only if upNode.Type is UPNODE_UPF and upNode.UPF is not nil, preventing potential nil pointer dereference errors.
  • Removed redundant call to upNode.UPF.CancelAssociation() outside the conditional, ensuring the method is only called when appropriate.

Copilot AI review requested due to automatic review settings March 23, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a panic scenario in the SMF UPI SBI handler by ensuring CancelAssociation() is only invoked for valid UPF nodes (and only when the UPF pointer is non-nil), aligning the deletion flow with the intended UP-node types.

Changes:

  • Guard CancelAssociation() behind upNode.Type == UPNODE_UPF && upNode.UPF != nil.
  • Move CancelAssociation() into the UPF-specific branch and remove the unconditional call after UpNodeDelete.
  • Keep UPF resource release triggered only for UPF nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@d11nn

d11nn commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

@Alonza0314 LGTM!

@Alonza0314 Alonza0314 merged commit b57bc48 into free5gc:main Mar 25, 2026
6 of 7 checks passed
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.

[Bugs] SMF UPI DELETE /upi/v1/upNodesLinks/{upNodeRef} panics on AN-node deletion via nil UPF dereference

4 participants