linux/sound/usb/usx2y
Kazuki Hanai 71c610aeb1 ALSA: us122l: Prevent write upgrades for read mappings
The hwdep mmap callback rejects read-buffer mappings that are initially
writable, but leaves VM_MAYWRITE set on mappings created with PROT_READ.
A process that can open the hwdep node O_RDWR can later use mprotect() to
make the mapping writable.

The read allocation begins with struct usb_stream. Its read_size member is
used by the fault handler to decide which pages belong to the read buffer.
The read VMA intentionally remains expandable because pcm_usb_stream uses
mremap() after reading that size. Changing read_size first can therefore
map and access pages beyond the allocation. The same member is also
consumed by usb_stream_free(), where changing it can make
free_pages_exact() release pages outside the allocation.

Clear VM_MAYWRITE for read-buffer mappings after rejecting an initially
writable VMA. This keeps the separate output-buffer mapping writable while
preventing later permission upgrades.

Fixes: 030a07e441 ("ALSA: Add USB US122L driver")
Cc: stable@vger.kernel.org
Signed-off-by: Kazuki Hanai <hnkz.64@gmail.com>
Link: https://patch.msgid.link/20260908110053.2950767-1-hnkz.64@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-09-08 16:22:50 +02:00
..
Makefile ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII 2025-08-15 17:53:47 +02:00
us122l.c ALSA: us122l: Prevent write upgrades for read mappings 2026-09-08 16:22:50 +02:00
us122l.h ALSA: us122l: Drop mmap_count field 2024-11-13 13:33:47 +01:00
us144mkii_capture.c ALSA: us144mkii: re-anchor capture URBs on resubmission 2026-08-04 18:06:37 +02:00
us144mkii_controls.c ALSA: us144mkii: Drop kernel-doc markers 2026-02-26 16:56:36 +01:00
us144mkii_midi.c ALSA: us144mkii: Drop kernel-doc markers 2026-02-26 16:56:36 +01:00
us144mkii_pcm.c ALSA: usx2y: Relax __free() variable declarations 2025-12-17 10:08:30 +01:00
us144mkii_pcm.h ALSA: usb-audio: um144mkii: use "var" keyword for data 2026-07-14 08:00:44 +02:00
us144mkii_playback.c ALSA: us144mkii: Drop kernel-doc markers 2026-02-26 16:56:36 +01:00
us144mkii.c ALSA: usx2y: us144mkii: fix work UAF on disconnect 2026-07-01 13:54:23 +02:00
us144mkii.h ALSA: usb-audio: us144mkii: Fixes for handshake, MIDI out and cleanup 2025-08-26 10:59:46 +02:00
usb_stream.c ALSA: usx2y: Drop no longer used variable 2024-08-09 09:57:33 +02:00
usb_stream.h ALSA: usx2y: Use standard print API 2024-08-08 07:49:47 +02:00
usbus428ctldefs.h ALSA: usx2y: Fix potential leaks of uninitialized memory 2021-05-17 16:04:10 +02:00
usbusx2y.c ALSA: usbusx2y: validate URB actual_length in interrupt callback 2026-09-06 10:10:52 +02:00
usbusx2y.h ALSA: usbusx2y: fix in04_last array size mismatch with in04_buf 2026-09-06 10:10:43 +02:00
usbusx2yaudio.c ALSA: usx2y: Stop clearing urb->hcpriv before submission 2026-08-10 13:38:32 +02:00
usx2y.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
usX2Yhwdep.c ALSA: usx2y: bound the hwdep mmap fault offset 2026-08-05 09:37:27 +02:00
usX2Yhwdep.h ALSA: usx2y: Fix spaces 2021-05-17 16:03:46 +02:00
usx2yhwdeppcm.c ALSA: usx2y: bound the hwdep mmap fault offset 2026-08-05 09:37:27 +02:00
usx2yhwdeppcm.h ALSA: usx2y: Avoid camelCase 2021-05-17 16:03:34 +02:00