diff options
| author | Avichal Rakesh <[email protected]> | 2023-11-08 16:41:04 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2023-11-23 12:32:44 +0000 |
| commit | da324ffce34c521b239f319d4051260444a3eb4a (patch) | |
| tree | c10c0db5864fb4a81818b026f144b4f079b9ed87 /tools/perf/scripts/python/export-to-postgresql.py | |
| parent | 2079b60bda3257146a4e8ed7525513865f7e6b3e (diff) | |
usb: gadget: uvc: Fix use-after-free for inflight usb_requests
Currently, the uvc gadget driver allocates all uvc_requests as one array
and deallocates them all when the video stream stops. This includes
de-allocating all the usb_requests associated with those uvc_requests.
This can lead to use-after-free issues if any of those de-allocated
usb_requests were still owned by the usb controller.
This is patch 2 of 2 in fixing the use-after-free issue. It adds a new
flag to uvc_video to track when frames and requests should be flowing.
When disabling the video stream, the flag is tripped and, instead
of de-allocating all uvc_requests and usb_requests, the gadget
driver only de-allocates those usb_requests that are currently
owned by it (as present in req_free). Other usb_requests are left
untouched until their completion handler is called which takes care
of freeing the usb_request and its corresponding uvc_request.
Now that uvc_video does not depends on uvc->state, this patch removes
unnecessary upates to uvc->state that were made to accommodate uvc_video
logic. This should ensure that uvc gadget driver never accidentally
de-allocates a usb_request that it doesn't own.
Link: https://lore.kernel.org/[email protected]
Reviewed-by: Daniel Scally <[email protected]>
Reviewed-by: Michael Grzeschik <[email protected]>
Suggested-by: Michael Grzeschik <[email protected]>
Tested-by: Michael Grzeschik <[email protected]>
Signed-off-by: Avichal Rakesh <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions