[PATCH v2 0/2] firewire: Fix out-of-bounds access in CSR iterator
From: Sreeraj S Kurup
Date: Tue Nov 03 2026 - 12:20:48 EST
Hi Takashi,
This series fixes an out-of-bounds read in fw_csr_iterator_next() and
adds KUnit tests for the CSR iterator.
The first patch fixes the iterator by checking its position before
dereferencing the current entry.
The second patch adds a separate KUnit test suite covering:
- Iteration over valid entries.
- Calling the iterator after reaching the end.
- Iteration over an empty directory.
It also adds a separate Kconfig option for the iterator tests.
Testing:
- Ran the FireWire KUnit tests using:
python3 tools/testing/kunit/kunit.py run
--kunitconfig=drivers/firewire/.kunitconfig
- All tests passed.
- Results:
[14:47:14] ======== firewire-config-rom-iterator (3 subtests) =========
[14:47:14] [PASSED] test_csr_iterator_with_valid_entries
[14:47:14] [PASSED] test_csr_iterator_at_end
[14:47:14] [PASSED] test_csr_iterator_empty_directory
[14:47:14] ========== [PASSED] firewire-config-rom-iterator ===========
Please review the patches.
Regards,
Sreeraj
Sreeraj S Kurup (2):
firewire: Fix out-of-bounds access in CSR iterator
firewire: Add KUnit tests for CSR iterator
drivers/firewire/.kunitconfig | 1 +
drivers/firewire/Kconfig | 12 +++
drivers/firewire/config-rom-iterator-test.c | 93 +++++++++++++++++++++
drivers/firewire/core-device.c | 10 ++-
4 files changed, 115 insertions(+), 1 deletion(-)
create mode 100644 drivers/firewire/config-rom-iterator-test.c
--
2.55.0