On Thu, 2024-11-28 at 16:16 -0800, Kumar Kartikeya Dwivedi wrote: > In preparation for introducing support for more reference types which > have to add and remove reference state, refactor the > acquire_reference_state and release_reference_state functions to share > common logic. > > The acquire_reference_state function simply handles growing the acquired > refs and returning the pointer to the new uninitialized element, which > can be filled in by the caller. > > The release_reference_state function simply erases a reference state > entry in the acquired_refs array and shrinks it. The callers are > responsible for finding the suitable element by matching on various > fields of the reference state and requesting deletion through this > function. It is not supposed to be called directly. > > Existing callers of release_reference_state were using it to find and > remove state for a given ref_obj_id without scrubbing the associated > registers in the verifier state. Introduce release_reference_nomark to > provide this functionality and convert callers. We now use this new > release_reference_nomark function within release_reference as well. > It needs to operate on a verifier state instead of taking verifier env > as mark_ptr_or_null_regs requires operating on verifier state of the > two branches of a NULL condition check, therefore env->cur_state cannot > be used directly. > > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> > --- Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> [...]