ALSA: usb-audio: fix set_format altsetting sanity check
authorJohan Hovold <johan@kernel.org>
Fri, 20 Dec 2019 09:31:34 +0000 (10:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:18:59 +0000 (10:18 +0100)
commit70986b20f631c497414a4a840b818d61ff70fc8e
treee6ef5bc4796d617f3e4777f65d84a4620ce49933
parentfb6b15324d2ff8910c096424f1b78e709e542c63
ALSA: usb-audio: fix set_format altsetting sanity check

commit 0141254b0a74b37aa7eb13d42a56adba84d51c73 upstream.

Make sure to check the return value of usb_altnum_to_altsetting() to
avoid dereferencing a NULL pointer when the requested alternate settings
is missing.

The format altsetting number may come from a quirk table and there does
not seem to be any other validation of it (the corresponding index is
checked however).

Fixes: b099b9693d23 ("ALSA: usb-audio: Avoid superfluous usb_set_interface() calls")
Cc: stable <stable@vger.kernel.org> # 4.18
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191220093134.1248-1-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/pcm.c