aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/validate.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-11-14 17:56:13 +0100
committerTakashi Iwai <tiwai@suse.de>2019-11-14 18:02:38 +0100
commitf35ef592477c5347b8f780a5f0d4970671e22c61 (patch)
treeb19652e43f89f4b8be1a22378a31fba657a98e6d /sound/usb/validate.c
parentALSA: hda/hdmi - Clean up Intel platform-specific fixup checks (diff)
downloadlinux-dev-f35ef592477c5347b8f780a5f0d4970671e22c61.tar.xz
linux-dev-f35ef592477c5347b8f780a5f0d4970671e22c61.zip
ALSA: usb-audio: Add skip_validation option
The unit descriptor validation may lead to a probe error when the device provides a buggy descriptor or the validator detected incorrectly. For identifying such an error and band-aiding, give a new module option, skip_validation. With this option, the driver ignores the validation errors with the hexdump of the unit descriptor, so we can check it in a bit more details. Link: https://lore.kernel.org/r/20191114165613.7422-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to '')
-rw-r--r--sound/usb/validate.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sound/usb/validate.c b/sound/usb/validate.c
index 389e8657434a..36ae78c3da3d 100644
--- a/sound/usb/validate.c
+++ b/sound/usb/validate.c
@@ -322,11 +322,28 @@ static bool validate_desc(unsigned char *hdr, int protocol,
bool snd_usb_validate_audio_desc(void *p, int protocol)
{
- return validate_desc(p, protocol, audio_validators);
+ unsigned char *c = p;
+ bool valid;
+
+ valid = validate_desc(p, protocol, audio_validators);
+ if (!valid && snd_usb_skip_validation) {
+ print_hex_dump(KERN_ERR, "USB-audio: buggy audio desc: ",
+ DUMP_PREFIX_NONE, 16, 1, c, c[0], true);
+ valid = true;
+ }
+ return valid;
}
bool snd_usb_validate_midi_desc(void *p)
{
- return validate_desc(p, UAC_VERSION_1, midi_validators);
+ unsigned char *c = p;
+ bool valid;
+
+ valid = validate_desc(p, UAC_VERSION_1, midi_validators);
+ if (!valid && snd_usb_skip_validation) {
+ print_hex_dump(KERN_ERR, "USB-audio: buggy midi desc: ",
+ DUMP_PREFIX_NONE, 16, 1, c, c[0], true);
+ valid = true;
+ }
+ return valid;
}
-