Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v4 0/3] ALSA: bebob/oxfw: bound AV/C response walks to the response length
@ 2026-12-05 17:14 Maoyi Xie via B4 Relay
  2026-12-05 17:14 ` [PATCH v4 1/3] ALSA: bebob: bound the channel position walk " Maoyi Xie via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maoyi Xie via B4 Relay @ 2026-12-05 17:14 UTC (permalink / raw)
  To: Takashi Sakamoto, Clemens Ladisch
  Cc: Jaroslav Kysela, Takashi Iwai, Maoyi Xie, linux-sound

The BeBoB and OXFW drivers walk three AV/C responses by counts that the
device puts into the response. None of the walks is checked against the
length of the response. A count that is too large reads past the
response buffer, or later past a stored copy of the format.

Each patch rejects such a response with -EIO. A complete response is
handled as before. The formats in the Griffin FireWave dump at [1] pass
the new check. I found no such dump of a BeBoB device.

Found with a CodeQL-based static analysis tool that we are developing.
Each case was reproduced in a userspace harness under AddressSanitizer.
Not tested on hardware. Compile-tested with W=1 on next-20261116.

I used an LLM to help write the harnesses and these patches.

Changes in v4:
- Patch 3 replaces patches 3 and 4 of v3. It splits the oxfw format
  parser in two, as Takashi Sakamoto suggested. One parser checks the
  responses from the unit. The other parses the cached formats.
- Patches 1 and 2 are unchanged.

v3: https://lore.kernel.org/all/20261202070452.732525-1-maoyixie.tju@gmail.com/
v2: https://lore.kernel.org/all/20261130104949.2216908-1-maoyixie.tju@gmail.com/
v1: https://lore.kernel.org/all/20261125121238.1602172-1-maoyixie.tju@gmail.com/

[1] https://lore.kernel.org/all/543FD6AA.5080004@sakamocchi.jp/

---
Maoyi Xie (3):
      ALSA: bebob: bound the channel position walk to the response length
      ALSA: bebob: bound the stream format entries to the response length
      ALSA: oxfw: bound the stream format entries to the response length

 sound/firewire/bebob/bebob.h         |  2 +-
 sound/firewire/bebob/bebob_command.c |  5 ++--
 sound/firewire/bebob/bebob_stream.c  | 15 ++++++++++--
 sound/firewire/oxfw/oxfw-stream.c    | 47 ++++++++++++++++++++++++++++++++----
 4 files changed, 59 insertions(+), 10 deletions(-)
---
base-commit: 9cef9067672e1bdd71b397264d03515ffed099f7
change-id: 20261206-firewire-avc-bounds-3d4723aaf14a

Best regards,
-- 
Maoyi Xie <maoyixie.tju@gmail.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-05 17:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 17:14 [PATCH v4 0/3] ALSA: bebob/oxfw: bound AV/C response walks to the response length Maoyi Xie via B4 Relay
2026-12-05 17:14 ` [PATCH v4 1/3] ALSA: bebob: bound the channel position walk " Maoyi Xie via B4 Relay
2026-12-05 17:14 ` [PATCH v4 2/3] ALSA: bebob: bound the stream format entries " Maoyi Xie via B4 Relay
2026-12-05 17:23   ` sashiko-bot
2026-12-05 17:14 ` [PATCH v4 3/3] ALSA: oxfw: " Maoyi Xie via B4 Relay
2026-12-05 17:29   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox