media: ti-vpe: cal: Restrict DMA to avoid memory corruption
authorNikhil Devshatwar <nikhil.nd@ti.com>
Tue, 12 Nov 2019 14:53:33 +0000 (15:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 18:40:05 +0000 (20:40 +0200)
commit318a2c03e3827d41431ab2b56c52a91157d4fb2f
tree704103e98f8396b10beefd55f8719c02863955eb
parent22b5ef715f5dee3c1a3bad5ec5254ef4980c230c
media: ti-vpe: cal: Restrict DMA to avoid memory corruption

[ Upstream commit 6e72eab2e7b7a157d554b8f9faed7676047be7c1 ]

When setting DMA for video capture from CSI channel, if the DMA size
is not given, it ends up writing as much data as sent by the camera.

This may lead to overwriting the buffers causing memory corruption.
Observed green lines on the default framebuffer.

Restrict the DMA to maximum height as specified in the S_FMT ioctl.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/ti-vpe/cal.c