Skip to content

firewire: Fix out-of-bounds access in CSR iterator

Sreeraj S Kurup lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 1 replySuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2firewire: Fix out-of-bounds access in CSR iteratordrivers/firewire/core-device.c+5 -10 replies
2/2firewire: Add KUnit tests for CSR iteratordrivers/firewire/.kunitconfig drivers/firewire/Kconfig drivers/firewire/config-rom-iterator-test.c +1 more+110 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] firewire: Fix out-of-bounds access in CSR iterator

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
Signature · 1 line
2.55.0