linux/sound/usb
Baul Lee 10a87401fb ALSA: usx2y: bound the hwdep mmap fault offset
commit 2ca1eea3cd upstream.

snd_us428ctls_vm_fault() turns the faulting page offset into a kernel
address with no bound of any kind:

	offset = vmf->pgoff << PAGE_SHIFT;
	vaddr = (char *)(...)->us428ctls_sharedmem + offset;
	page = virt_to_page(vaddr);
	get_page(page);
	vmf->page = page;

	return 0;

snd_us428ctls_mmap() checks only the length of the mapping, never the
offset, and us428ctls_sharedmem is a single page from
alloc_pages_exact().  For a character device file_mmap_size_max()
returns ULONG_MAX, so the mm layer imposes no ceiling either.  Every page
offset above zero resolves to a struct page outside the object, and the
handler installs it into the caller's address space read-write; the vma
is not marked read-only.

The caller picks the page frame with a single mmap() argument and gets
read-write access to a page of kernel memory it does not own; an offset
that lands in an unpopulated vmemmap region oopses instead.

A process that can open the hwdep node of an attached US-X2Y reaches
this after loading the FPGA image through the same node; no capability
check is involved.

On 7.2.0-rc5 (arm64), mmap() with a large offset:

  Unable to handle kernel paging request at virtual address fffffdffc45d5ac8
  pc : snd_us428ctls_vm_fault+0x68/0x140 [snd_usb_usx2y]
  Call trace:
   snd_us428ctls_vm_fault+0x68/0x140 [snd_usb_usx2y]
   __do_fault
   __handle_mm_fault
   handle_mm_fault
   el0_da

Reject any offset outside the shared region.  The pcm hwdep handler in
usx2yhwdeppcm.c computes its address the same way and needs the same
bound.

Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
Reported-by: Baul Lee <baul.lee@xbow.com>
Cc: stable@vger.kernel.org
Signed-off-by: Baul Lee <baul.lee@xbow.com>
Link: https://patch.msgid.link/20260805013445.38283-1-baul.lee@xbow.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-08-19 17:14:16 +02:00
..
6fire ALSA: 6fire: Fix UAF at error handling during probe 2026-08-19 17:14:09 +02:00
bcd2000 ALSA: bcd2000: Fix a UAF bug on the error path of probing 2022-08-17 14:22:46 +02:00
caiaq ALSA: caiaq: fix out-of-bounds read in the Traktor Kontrol S4 input parser 2026-07-24 15:51:19 +02:00
hiface module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
line6 ALSA: line6: add hw monitor volume control to POD HD500X 2024-10-17 15:11:36 +02:00
misc ALSA: ua101: Reject too-short USB descriptors 2026-06-01 17:35:46 +02:00
usx2y ALSA: usx2y: bound the hwdep mmap fault offset 2026-08-19 17:14:16 +02:00
card.c ALSA: usb-audio: Fix NULL pointer deference in try_to_register_card 2025-10-29 14:03:09 +01:00
card.h ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless 2024-03-15 10:48:19 -04:00
clock.c ALSA: usb-audio: Fix out of bounds reads when finding clock sources 2024-12-14 19:51:11 +01:00
clock.h ALSA: usb-audio: Constify audioformat pointer references 2020-11-23 15:15:36 +01:00
endpoint.c ALSA: usb-audio: fix OOB write on Type II inbound URBs 2026-08-19 17:14:14 +02:00
endpoint.h ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless 2024-03-15 10:48:19 -04:00
format.c ALSA: usb-audio: stop parsing UAC2 rates at MAX_NR_RATES 2026-06-01 17:35:13 +02:00
format.h ALSA: usb: initial USB Audio Device Class 3.0 support 2018-03-21 11:46:33 +01:00
helper.c ALSA: usb-audio: Add snd_usb_get_host_interface() helper 2020-11-23 15:13:47 +01:00
helper.h ALSA: usb-audio: Add snd_usb_get_host_interface() helper 2020-11-23 15:13:47 +01:00
implicit.c ALSA: usb-audio: Add implicit feedback quirk for RODE AI-1 2025-06-27 11:05:21 +01:00
implicit.h ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless 2024-03-15 10:48:19 -04:00
Kconfig sound: Fix Kconfig indentation 2019-10-07 03:53:03 +02:00
Makefile ALSA: usb-audio: Factor out the implicit feedback quirk code 2020-11-23 15:17:00 +01:00
media.c ALSA: usb-audio: fix spelling mistakes 2021-07-05 19:33:54 +02:00
media.h media: sound/usb: Use Media Controller API to share media resources 2019-04-22 11:21:06 -04:00
midi.c ALSA: usb-audio: fix OOB write in snd_usbmidi_akai_output() 2026-08-19 17:14:09 +02:00
midi.h ALSA: usb-audio: generate midi streaming substream names from jack names 2021-03-01 09:21:54 +01:00
mixer.c Revert "ALSA: usb: Increase volume range that triggers a warning" 2026-06-01 17:35:14 +02:00
mixer.h ALSA: usb-audio: Add input value sanity checks for standard types 2024-10-17 15:11:27 +02:00
mixer_maps.c ALSA: usb-audio: Rename ALSA kcontrol PCM and PCM1 for the KTMicro sound card 2025-06-27 11:05:34 +01:00
mixer_quirks.c ALSA: usb-audio: Update Babyface Pro control caches only after successful writes 2026-07-24 15:51:19 +02:00
mixer_quirks.h ALSA: usb-audio: Initialize Dell Dock playback volumes 2018-05-02 16:02:32 +02:00
mixer_s1810c.c ALSA: usb-audio: add mono main switch to Presonus S1824c 2025-12-07 06:09:24 +09:00
mixer_s1810c.h ALSA: usb-audio: Add support for Presonus Studio 1810c 2020-02-15 09:46:16 +01:00
mixer_scarlett.c ALSA: usb-audio: Propagate errors in scarlett_ctl_enum_put() 2026-07-24 15:51:19 +02:00
mixer_scarlett.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mixer_scarlett_gen2.c ALSA: scarlett2: Fix buffer overflow in config retrieval 2026-02-06 16:42:03 +01:00
mixer_scarlett_gen2.h ALSA: usb-audio: scarlett2: Improve driver startup messages 2021-05-21 16:22:52 +02:00
mixer_us16x08.c ALSA: usb-audio: Update US-16x08 EQ/comp shadow state after successful writes 2026-07-24 15:51:19 +02:00
mixer_us16x08.h ALSA: usb: Constify snd_kcontrol_new items 2020-01-03 09:24:34 +01:00
pcm.c ALSA: usb-audio: Fix possible NULL pointer dereference in snd_usb_pcm_has_fixed_rate() 2024-10-17 15:11:48 +02:00
pcm.h ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless 2024-03-15 10:48:19 -04:00
power.c ALSA: usb-audio: More validations of descriptor units 2019-08-22 10:35:59 +02:00
power.h ALSA: usb-audio: Initial Power Domain support 2018-07-31 15:01:22 +02:00
proc.c ALSA: usb-audio: Show sync endpoint information in proc outputs 2020-11-23 15:16:45 +01:00
proc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quirks-table.h ALSA: usb-audio: Fix Yamaha P-125 Quirk Entry 2024-12-14 19:50:41 +01:00
quirks.c ALSA: usb-audio: Skip DSD quirk for Musical Fidelity M6s DAC 2026-08-19 17:13:54 +02:00
quirks.h ALSA: usb-audio: Register card at the last interface 2022-10-26 12:35:39 +02:00
stream.c ALSA: usb-audio: Fix UAC3 cluster descriptor size check 2026-06-01 17:35:20 +02:00
stream.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usbaudio.h ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless 2024-03-15 10:48:19 -04:00
validate.c ALSA: usb-audio: Use correct version for UAC3 header validation 2026-04-18 10:33:09 +02:00