]> www.infradead.org Git - users/dwmw2/linux.git/commit
firmware: cs_dsp: Validate payload length before processing block
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Thu, 27 Jun 2024 14:14:31 +0000 (15:14 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 1 Jul 2024 13:10:24 +0000 (14:10 +0100)
commit6598afa9320b6ab13041616950ca5f8f938c0cf1
tree68e96e05fdd7a07b529e13581686122160c61f0b
parent959fe01e85b7241e3ec305d657febbe82da16a02
firmware: cs_dsp: Validate payload length before processing block

Move the payload length check in cs_dsp_load() and cs_dsp_coeff_load()
to be done before the block is processed.

The check that the length of a block payload does not exceed the number
of remaining bytes in the firwmware file buffer was being done near the
end of the loop iteration. However, some code before that check used the
length field without validating it.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: f6bc909e7673 ("firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs")
Link: https://patch.msgid.link/20240627141432.93056-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/firmware/cirrus/cs_dsp.c