diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-06-16 19:32:34 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-06-25 23:47:13 +0900 |
commit | 9909ce33f91b4ce7e9c61a28dbf91b7b24fd1161 (patch) | |
tree | 1df478a433dbf48d535a572be85d38d1f0826b0e /test/process/process_test.cpp | |
parent | 566ccd75cafd0bd9d60d350405ca7d337786ae39 (diff) |
v4l2: v4l2_camera: Clear pending requests on freeBuffers and streamOff
V4L2 allows buffer queueing before streamon while libcamera does not.
The compatibility layer thus saves these buffers in a pending queue
until streamon, and then automatically queues them. However, this
pending queue is not cleared when the buffers are freed, so the
following sequence of actions will cause a use-after-free:
1. queue buffers
2. free buffers
- buffers from 1. stay in pending queue but have been freed
3. queue buffers
4. streamon
- buffers from 1. are enqueued, then the buffers from 3. are
enqueued. Use-after-free segfault when libcamera tries to handle
the enqueued buffers from 1.
Fix this by clearing the pending request queue upon buffers being freed.
Also clear the pending request queue on streamOff, for correctness.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/process/process_test.cpp')
0 files changed, 0 insertions, 0 deletions