FROMGIT: media: venus: hfi: add check to handle incorrect queue size
qsize represents size of shared queued between driver and video
firmware. Firmware can modify this value to an invalid large value. In
such situation, empty_space will be bigger than the space actually
available. Since new_wr_idx is not checked, so the following code will
result in an OOB write.
...
qsize = qhdr->q_size
if (wr_idx >= rd_idx)
empty_space = qsize - (wr_idx - rd_idx)
....
if (new_wr_idx < qsize) {
memcpy(wr_ptr, packet, dwords << 2) --> OOB write
Add check to ensure qsize is within the allocated size while
reading and writing packets into the queue.
Cc: stable@vger.kernel.org
Fixes: d96d3f30 ("[media] media: venus: hfi: add Venus HFI files")
Reviewed-by:
Bryan O'Donoghue <bryan.odonoghue@linaro.org>
CRs-Fixed: 3935673
Git-commit: 69baf245
Git-repo: https://gitlab.freedesktop.org/linux-media/media-committers.git
Change-Id: If2c367e95b7cf4a7d53e033b02f24cf2b6186837
Signed-off-by:
Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by:
Poojitha Yakkala <quic_pyakkala@quicinc.com>
Loading
Please sign in to comment