pimd: harden BSM group/RP parsing paths - #21734
Conversation
Greptile SummaryThis PR hardens Confidence Score: 5/5Safe to merge; both prior P1 findings are correctly resolved and no new P0/P1 issues were found. The two previous P1 findings β unconditional BS timer restart and pend_rp_cnt not being decremented on limit-hit β are directly addressed (timer restart moved before parsing; break instead of return false). Counter accounting across all paths (free, swap, clear-on-new-tag, holdtime-zero removal) is correct. The AFI/mask tightening and skip-ahead logic are well-implemented. Remaining considerations (temporary peak up to 2ΓMAX during group refresh, pend_rp_cnt staying > 0 when skipped RPs never return in the same epoch) are documented design trade-offs, not bugs. No files require special attention; pimd/pim_bsm.c deserves a second read on the bsrp_rp_count accounting across pim_instate_pend_list and pim_update_pending_rp_cnt, but all paths appear correct. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[pim_bsm_process: receive BSM] --> B{is_preferred_bsr?}
B -- No --> Z[drop BSM]
B -- Yes --> C[pim_bs_timer_restart\nnow unconditional]
C --> D[pim_bsm_parse_install_g2rp]
D --> E{for each Group TLV\nin buffer}
E --> F{AFI/mask\nvalid?\nnew check}
F -- No --> Z2[return false]
F -- Yes --> G{bsgrp node\nexists?}
G -- No, new group --> H{bsrp_rp_count\n>= MAX_RP_ENTRIES?}
H -- Yes --> I[skip frag_rp_count\nRP bytes, continue]
H -- No --> J[create bsgrp node]
G -- Yes --> K[use existing node]
J --> K
K --> L{for each RP TLV\nin fragment}
L --> M[pim_install_bsm_grp_rp]
M --> N{scope_cannot_add_rp?\nwith old-epoch slack}
N -- Yes --> O[return false]
N -- No --> P{bsm_rpinfos_add\nsuccess?}
P -- Yes --> Q[in_scope_count=true\nbsrp_rp_count++\nreturn true]
P -- No dup --> R[free, return false]
O --> S{caller: still\ncannot add?}
R --> S
S -- Yes --> T[skip remaining RP bytes\nbreak]
S -- No --> U[continue]
Q --> V[ins_count++]
V --> L
T --> W[pend_rp_cnt -= ins_count]
L -- exhausted --> W
W --> X{pend_rp_cnt == 0?}
X -- Yes --> Y[pim_instate_pend_list\nswap lists, free old\ndecrement bsrp_rp_count]
X -- No --> E
Y --> E
Reviews (3): Last reviewed commit: "pimd: harden BSM group/RP parsing paths" | Re-trigger Greptile |
|
@greptile review |
Bound BSR-derived (G,RP) state growth and tighten AFI/mask validation so malformed or flooded BSM input cannot drive unbounded allocations. Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
|
@greptile review |
|
@Mergifyio backport stable/10.6 stable/10.5 stable/10.4 |
β No backport have been createdDetails
Git reported the following error:
|
pimd: harden BSM group/RP parsing paths (backport #21734)
pimd: harden BSM group/RP parsing paths (backport #21734)
pimd: harden BSM group/RP parsing paths (backport #21734)
Bound BSR-derived (G,RP) state growth and tighten AFI/mask validation so malformed or flooded BSM input cannot drive unbounded allocations.