Skip to contentSkip to conversation

firmware: cs_dsp: Fix OOB memory read access in KUnit test (ctl cache)

PATCH In review Jaroslav Kysela 3 participants 3 messages May 23, 2025 – May 26, 2025

Subsystems (3)
lore
Share & tools
lore

Jaroslav Kysela

author maintainer
#0 lore raw

PATCH 1/1 firmware: cs_dsp: Fix OOB memory read access in KUnit test (ctl cache)

KASAN reported out of bounds access - cs_dsp_ctl_cache_init_multiple_offsets(). The code uses mock_coeff_template.length_bytes (4 bytes) for register value allocations. But later, this length is set to 8 bytes which causes test code failures.

As fix, just remove the lenght override, keeping the original value 4 for all operations.

---
 drivers/firmware/cirrus/test/cs_dsp_test_control_cache.c | 1 -
 1 file changed, 1 deletion(-)
drivers/firmware/cirrus/test/cs_dsp_test_control_cache.c +0 -1
index 83386cc978e3..ebca3a4ab0f1 100644
@@ -776,7 +776,6 @@ static void cs_dsp_ctl_cache_init_multiple_offsets(struct kunit *test)
 					      "dummyalg", NULL);
 
 	/* Create controls identical except for offset */
-	def.length_bytes = 8;
 	def.offset_dsp_words = 0;
 	def.shortname = "CtlA";
 	cs_dsp_mock_wmfw_add_coeff_desc(local->wmfw_builder, &def);
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jaroslav Kysela

KASAN reported out of bounds access - cs_dsp_ctl_cache_init_multiple_offsets(). The code uses mock_coeff_template.length_bytes (4 bytes) for register value allocations. But later, this length is set to 8 bytes which causes test code failures.

As fix, just remove the lenght override, keeping the original value 4 for all operations.

Quoted 6 lines
#2 lore raw
In reply to Jaroslav Kysela
Quoted 9 lines · Jaroslav Kysela

KASAN reported out of bounds access - cs_dsp_ctl_cache_init_multiple_offsets(). The code uses mock_coeff_template.length_bytes (4 bytes) for register value allocations. But later, this length is set to 8 bytes which causes test code failures.

As fix, just remove the lenght override, keeping the original value 4 for all operations.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] firmware: cs_dsp: Fix OOB memory read access in KUnit test (ctl cache)

      commit: f4ba2ea57da51d616b689c4b8826c517ff5a8523

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark