camerad: prevent redundant request re-enqueue after frame ID jump #34665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolve #34663
When a frame id jump occurs, the code clears the request queue and re-enqueues requests via
enqueue_req_multi
. However, the subsequent check for dropped request ids(request_id > request_id_last + 1)
could redundantly trigger anotherenqueue_req_multi
call, this risks overwriting buf_idx, request_id, and sync objects, potentially leading to invalid states, such as waiting on obsolete sync objects or mismanaging buffer slots.Additionally, this behavior can result in duplicate request IDs being sent to CAM_REQ_MGR_SCHED_REQ. this could overwrite or merge the state of the original request with the new one, causing state corruption. In some cases, if memory is allocated per request and tied to the ID, the original request’s memory may become unreachable, resulting in a memory leak.
The following errors were observed in the cam_log.txt: