All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] ALSA: bebob/oxfw: bound AV/C response walks to the response length
@ 2026-12-02  7:04 Maoyi Xie
  2026-12-02  7:04 ` [PATCH v3 1/4] ALSA: bebob: bound the channel position walk " Maoyi Xie
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Maoyi Xie @ 2026-12-02  7:04 UTC (permalink / raw)
  To: Clemens Ladisch, Takashi Sakamoto
  Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, stable

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 v3:
- Patch 3 checks the entries at discovery, as Takashi Sakamoto
  suggested. It no longer checks the cached formats or stores their
  lengths.
- Patch 4 is new and checks the response that
  snd_oxfw_stream_get_current_formation() reads.
- Patches 1 and 2 are unchanged.

Changes in v2:
- Patch 3 checks the length in snd_oxfw_stream_parse_format() instead of
  a new function, as Takashi Sakamoto suggested. The stored formats keep
  their length for the later calls.
- Patches 1 and 2 are unchanged.

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 (4):
  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
  ALSA: oxfw: bound the current 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    | 16 +++++++++++++++-
 4 files changed, 32 insertions(+), 6 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2026-12-02  7:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  7:04 [PATCH v3 0/4] ALSA: bebob/oxfw: bound AV/C response walks to the response length Maoyi Xie
2026-12-02  7:04 ` [PATCH v3 1/4] ALSA: bebob: bound the channel position walk " Maoyi Xie
2026-12-02  7:04 ` [PATCH v3 2/4] ALSA: bebob: bound the stream format entries " Maoyi Xie
2026-12-02  7:15   ` sashiko-bot
2026-12-02  7:04 ` [PATCH v3 3/4] ALSA: oxfw: " Maoyi Xie
2026-12-02  7:04 ` [PATCH v3 4/4] ALSA: oxfw: bound the current " Maoyi Xie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.