pimd: Fix crash when up->channel_oil is NULL - #21961
Conversation
The up->channel_oil is being de-referenced without any NULL check. In events like VRF migration, where the timer fires in some cases when the up->channel_oil is already deleted it could lead to intermittent crash. Signed-off-by: usrivastava-nvidia <usrivastava@nvidia.com>
Greptile SummaryThis PR adds NULL checks for
Confidence Score: 5/5Safe to merge β the change is a targeted defensive fix that prevents NULL dereference crashes without altering any control flow when All six changed call sites follow the same straightforward pattern: a simple short-circuit guard is added before an unconditional pointer dereference. The guards are consistent with how similar NULL checks appear elsewhere in the codebase, and no logic is changed for the non-NULL path. No files require special attention. Both changed files are small, focused, and the pattern is uniform across all touch points. Important Files Changed
Sequence DiagramsequenceDiagram
participant Timer as Timer Event
participant Handler as Timer Handler
participant Oil as channel_oil
participant MRoute as MRoute Subsystem
Note over Oil: VRF migration frees channel_oil
Timer->>Handler: fires (up still alive)
Handler->>Handler: "up = EVENT_ARG(t)"
Handler->>Handler: check !up β OK
Handler->>Oil: "(BEFORE fix) up->channel_oil->installed β CRASH"
Handler->>Oil: "(AFTER fix) up->channel_oil != NULL?"
alt channel_oil is NULL
Handler->>Handler: return early (no crash)
else channel_oil exists and installed
Handler->>MRoute: pim_mroute_update_counters / oil_if_set
end
Reviews (1): Last reviewed commit: "pimd: Fix crash when up->channel_oil is ..." | Re-trigger Greptile |
|
@Mergifyio backport stable/10.6 stable/10.5 stable/10.4 |
β Backports have been createdDetails
|
pimd: Fix crash when up->channel_oil is NULL (backport #21961)
pimd: Fix crash when up->channel_oil is NULL (backport #21961)
pimd: Fix crash when up->channel_oil is NULL (backport #21961)
The up->channel_oil is being de-referenced
without any NULL check.
In events like VRF migration, where the timer fires in some cases when the up->channel_oil is already deleted it could lead to intermittent crash.