* [PATCH] mfd: cs42l43: Sanity check firmware size
@ 2026-05-08 13:48 Charles Keepax
2026-05-20 14:32 ` (subset) " Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2026-05-08 13:48 UTC (permalink / raw)
To: lee; +Cc: linux-kernel, patches
Currently the code checks if a firmware was received, however it does
not verify that the firmware size is larger than the firmware header. As
the firmware pointer is dereferenced as a pointer to the header
structure this could lead to an out of bounds memory access. Add the
missing check.
Fixes: ace6d1448138 ("mfd: cs42l43: Add support for cs42l43 core driver")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
drivers/mfd/cs42l43.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/cs42l43.c b/drivers/mfd/cs42l43.c
index 166881751e698..ed6d93893de04 100644
--- a/drivers/mfd/cs42l43.c
+++ b/drivers/mfd/cs42l43.c
@@ -722,7 +722,7 @@ static void cs42l43_mcu_load_firmware(const struct firmware *firmware, void *con
unsigned int loadaddr, val;
int ret;
- if (!firmware) {
+ if (!firmware || firmware->size < sizeof(*hdr)) {
dev_err(cs42l43->dev, "Failed to load firmware\n");
cs42l43->firmware_error = -ENODEV;
goto err;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: (subset) [PATCH] mfd: cs42l43: Sanity check firmware size
2026-05-08 13:48 [PATCH] mfd: cs42l43: Sanity check firmware size Charles Keepax
@ 2026-05-20 14:32 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-05-20 14:32 UTC (permalink / raw)
To: lee, Charles Keepax; +Cc: linux-kernel, patches
On Fri, 08 May 2026 14:48:04 +0100, Charles Keepax wrote:
> Currently the code checks if a firmware was received, however it does
> not verify that the firmware size is larger than the firmware header. As
> the firmware pointer is dereferenced as a pointer to the header
> structure this could lead to an out of bounds memory access. Add the
> missing check.
>
>
> [...]
Applied, thanks!
[1/1] mfd: cs42l43: Sanity check firmware size
commit: 00141b30b2aebbeab67d1497ff1b48ea738518a9
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-20 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-08 13:48 [PATCH] mfd: cs42l43: Sanity check firmware size Charles Keepax
2026-05-20 14:32 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®