Bluetooth: btmrvl_sdio: Bound fw dump count by memory table size
PATCH 1/1 Bluetooth: btmrvl_sdio: Bound fw dump count by memory table size
btmrvl_sdio_coredump() runs when root writes the coredump attribute. It reads the number of memory regions, dump_num, from a card register. Two loops then walk mem_type_mapping_tbl[] up to dump_num, but the table has 15 entries.
If the card reports more than 15, the first loop can store a vzalloc() pointer and a size past the table. The second loop copies from the pointer it finds there, then frees it.
Limit dump_num to the size of the table, as commit dbca9dfd3bfc ("wifi: mwifiex: bound SDIO fw dump count by memory table size") did in mwifiex.
Found with a CodeQL-based static analysis tool that we are developing. Reproduced in a userspace harness under AddressSanitizer. Not tested on hardware.
---
I used an LLM to help write the harness and this patch.
drivers/bluetooth/btmrvl_sdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btmrvl_sdio.c +4 -0
@@ -1378,6 +1378,10 @@ static void btmrvl_sdio_coredump(struct device *dev) goto done; } +/* Limit the dump count to the memory table size */ +if (dump_num >ARRAY_SIZE (mem_type_mapping_tbl)) + dump_num =ARRAY_SIZE (mem_type_mapping_tbl); +/* Read the length of every memory which will dump */ for (idx =0 ; idx < dump_num; idx++) {struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx];
Signature · 1 line
2.34.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1222074/
---Test result---
Test Summary:
CheckPatch PASS 0.51 seconds VerifyFixes PASS 0.10 seconds VerifySignedoff PASS 0.09 seconds GitLint PASS 0.27 seconds SubjectPrefix PASS 0.09 seconds BuildKernel PASS 17.68 seconds CheckAllWarning PASS 20.91 seconds CheckSparse PASS 22.20 seconds BuildKernel32 PASS 19.48 seconds CheckKernelLLVM PASS 20.02 seconds TestRunnerSetup PASS 430.45 seconds IncrementalBuild PASS 17.84 seconds
https://github.com/bluez/bluetooth-next/pull/1224
---
Regards,
Linux Bluetooth