392cff2f | 08-Jul-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Use strnlen() on name fields in V1 wmfw files
[ Upstream commit 680e126ec0400f6daecf0510c5bb97a55779ff03 ]
Use strnlen() instead of strlen() on the algorithm and coefficient name
firmware: cs_dsp: Use strnlen() on name fields in V1 wmfw files
[ Upstream commit 680e126ec0400f6daecf0510c5bb97a55779ff03 ]
Use strnlen() instead of strlen() on the algorithm and coefficient name string arrays in V1 wmfw files.
In V1 wmfw files the name is a NUL-terminated string in a fixed-size array. cs_dsp should protect against overrunning the array if the NUL terminator is missing.
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/20240708144855.385332-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
76ea8e13 | 27-Jun-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Prevent buffer overrun when processing V2 alg headers
[ Upstream commit 2163aff6bebbb752edf73f79700f5e2095f3559e ]
Check that all fields of a V2 algorithm header fit into the avai
firmware: cs_dsp: Prevent buffer overrun when processing V2 alg headers
[ Upstream commit 2163aff6bebbb752edf73f79700f5e2095f3559e ]
Check that all fields of a V2 algorithm header fit into the available firmware data buffer.
The wmfw V2 format introduced variable-length strings in the algorithm block header. This means the overall header length is variable, and the position of most fields varies depending on the length of the string fields. Each field must be checked to ensure that it does not overflow the firmware data buffer.
As this ia bugfix patch, the fixes avoid making any significant change to the existing code. This makes it easier to review and less likely to introduce new bugs.
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-5-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
3a9cd924 | 27-Jun-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Validate payload length before processing block
[ Upstream commit 6598afa9320b6ab13041616950ca5f8f938c0cf1 ]
Move the payload length check in cs_dsp_load() and cs_dsp_coeff_load()
firmware: cs_dsp: Validate payload length before processing block
[ Upstream commit 6598afa9320b6ab13041616950ca5f8f938c0cf1 ]
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> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
90ab191b | 27-Jun-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Return error if block header overflows file
[ Upstream commit 959fe01e85b7241e3ec305d657febbe82da16a02 ]
Return an error from cs_dsp_power_up() if a block header is longer than th
firmware: cs_dsp: Return error if block header overflows file
[ Upstream commit 959fe01e85b7241e3ec305d657febbe82da16a02 ]
Return an error from cs_dsp_power_up() if a block header is longer than the amount of data left in the file.
The previous code in cs_dsp_load() and cs_dsp_load_coeff() would loop while there was enough data left in the file for a valid region. This protected against overrunning the end of the file data, but it didn't abort the file processing with an error.
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-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
107c1674 | 20-Mar-2023 |
Simon Trimmer <simont@opensource.cirrus.com> |
firmware: cs_dsp: Support DSPs that don't require firmware download
When a DSP can self-boot from ROM it is not necessary to download firmware during the powering up sequence.
A DSP that required f
firmware: cs_dsp: Support DSPs that don't require firmware download
When a DSP can self-boot from ROM it is not necessary to download firmware during the powering up sequence.
A DSP that required firmware download would fail in a previous configuration step if firmware was not available.
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230320112245.115720-4-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
a4b97655 | 22-Jul-2022 |
Charles Keepax <ckeepax@opensource.cirrus.com> |
firmware: cs_dsp: Add memory chunk helpers
Add helpers that can be layered on top of a buffer read from or to be written to the DSP to faciliate accessing datastructures within the DSP memory. These
firmware: cs_dsp: Add memory chunk helpers
Add helpers that can be layered on top of a buffer read from or to be written to the DSP to faciliate accessing datastructures within the DSP memory. These functions handle adding the padding bytes for the DSP, converting to big endian, and packing arbitrary length data.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220722094851.92521-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|