Skip to content
Commit 6ab55ec0 authored by Zheyu Ma's avatar Zheyu Ma Committed by Takashi Iwai
Browse files

ALSA: control: Fix an out-of-bounds bug in get_ctl_id_hash()



Since the user can control the arguments provided to the kernel by the
ioctl() system call, an out-of-bounds bug occurs when the 'id->name'
provided by the user does not end with '\0'.

The following log can reveal it:

[    10.002313] BUG: KASAN: stack-out-of-bounds in snd_ctl_find_id+0x36c/0x3a0
[    10.002895] Read of size 1 at addr ffff888109f5fe28 by task snd/439
[    10.004934] Call Trace:
[    10.007140]  snd_ctl_find_id+0x36c/0x3a0
[    10.007489]  snd_ctl_ioctl+0x6cf/0x10e0

Fix this by checking the bound of 'id->name' in the loop.

Fixes: c27e1efb ("ALSA: control: Use xarray for faster lookups")
Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/20220824081654.3767739-1-zheyuma97@gmail.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2e6481a3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment