media: bcm2835-unicam: Fix for possible dummy buffer overrun
authorNaushir Patuck <naush@raspberrypi.com>
Fri, 2 Sep 2022 07:35:35 +0000 (08:35 +0100)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Fri, 2 Sep 2022 07:50:02 +0000 (08:50 +0100)
commitd331f456e6acd1a2bee6ccb9e96341b024fbe53e
tree441d37601a497ff9aac1ea5b60f382acff9020e3
parentf64b5666e11dce481737208027d4af300c63842d
media: bcm2835-unicam: Fix for possible dummy buffer overrun

The Unicam hardware has been observed to cause a buffer overrun when using the
dummy buffer as a circular buffer. The conditions that cause the overrun are not
fully known, but it seems to occur when the memory bus is heavily loaded.

To avoid the overrun, program the hardware with a buffer size of 0 when using
the dummy buffer. This will cause overrun into the allocated dummy buffer, but
avoid out of bounds writes.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers/media/platform/bcm2835/bcm2835-unicam.c