summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-03-24 08:50:05 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-05 11:14:21 +0200
commita795f95e63e5a60db653a946e3a6f0ed21daecac (patch)
tree16065178aff991af512f1af50c14554f6b5122a8 /sound
parent36bfbaa295507e74bc0b038959b653ea733f5edb (diff)
downloadlinux-stable-a795f95e63e5a60db653a946e3a6f0ed21daecac.tar.gz
linux-stable-a795f95e63e5a60db653a946e3a6f0ed21daecac.tar.bz2
linux-stable-a795f95e63e5a60db653a946e3a6f0ed21daecac.zip
ALSA: usb-audio: Fix regression on detection of Roland VS-100
commit fa4e7a6fa12b1132340785e14bd439cbe95b7a5a upstream. It's been reported that the recent kernel can't probe the PCM devices on Roland VS-100 properly, and it turned out to be a regression by the recent addition of the bit shift range check for the format bits. In the old code, we just did bit-shift and it resulted in zero, which is then corrected to the standard PCM format, while the new code explicitly returns an error in such a case. For addressing the regression, relax the check and fallback to the standard PCM type (with the info output). Fixes: 43d5ca88dfcd ("ALSA: usb-audio: Fix potential out-of-bounds shift") Cc: <stable@vger.kernel.org> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217084 Link: https://lore.kernel.org/r/20230324075005.19403-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/format.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 56b5baee6552..3a0f8cb7e831 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -52,8 +52,12 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
case UAC_VERSION_1:
default: {
struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
- if (format >= 64)
- return 0; /* invalid format */
+ if (format >= 64) {
+ usb_audio_info(chip,
+ "%u:%d: invalid format type %#x is detected, processed as PCM\n",
+ fp->iface, fp->altsetting, format);
+ format = UAC_FORMAT_TYPE_I_PCM;
+ }
sample_width = fmt->bBitResolution;
sample_bytes = fmt->bSubframeSize;
format = 1 << format;