[libcamera-devel,0/2] libcamera: Request: Catch double completions
mbox series

Message ID 20210302122341.83985-1-kieran.bingham@ideasonboard.com
Headers show
Series
  • libcamera: Request: Catch double completions
Related show

Message

Kieran Bingham March 2, 2021, 12:23 p.m. UTC
If a Request is completed, when it has already been completed, this is
the equivalent to a use-after-free.

When completed, the application regains control of the object, and can
choose to either free the memory, or call request->reuse().

In both of those scenarios the Request should not be touch by the
Pipeline Handler until it is re-queued.

There appear to be some races or bugs around here, so add an assert to
catch this early, and fix a comment related to the usage.

Kieran Bingham (2):
  libcamera: Request: validate state on complete
  libcamera: pipeline_handler: Update request usage comment

 src/libcamera/pipeline_handler.cpp | 4 ++--
 src/libcamera/request.cpp          | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)