Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp879544pxk; Thu, 17 Sep 2020 20:09:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/+iPeXF86fACEN9xJGy9aNxgibP3o8K4C4Q0az+1jxCVe5mQBJzdfcnRqvoNqGyc1VfP4 X-Received: by 2002:a17:906:c1d2:: with SMTP id bw18mr34780312ejb.240.1600398581003; Thu, 17 Sep 2020 20:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398580; cv=none; d=google.com; s=arc-20160816; b=h4xGG0+7irGLU5MJbziBOIDyIKYAJJkqfjB5hOnYHiIfIQTT99rfO4O3cb7mkza6yz uocisdeqhoJvWCpQPH0UH5e3P9pdlbSV1Nve3WOi7leuZfYyFwF9d0bNJzPN8YvYFTG/ LeqF0+6LNlnzCotRxAo7DvaORBAcd+UHGEz6k4v3yIx0C9kgo3B6d+2OjclhJdbVo9nY 4tb3j0WNrwnWgu5AHGHSpEL4Bl2yXWIqa7bZ/iYJAGKn0Bv4u1UaNDV5UbHr3bfi7M3g VMPAeMh3v21KJ94BghVpIxtGiPuvoADXPe2S1Ix/1fYe4YeeltlcooeVYABEY5AvFmxN 6qrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HV3VgxQfCQnLUcAB3CBVRPBLK/Q97Jaw4bdw58dquYo=; b=Snfu1oJ6zFxQJiWVfQ0KrB/MJ9Cc47ExgbKDYQNI43+G7iIjI6pnYkREph/OGyxq0V 4gduMtCgiBsOZA7LmdfiJdxFRv8LcNqNWZQmYuLxEOOCX+Ya9FLMc7WSanGy5oSxbTnI vuQlz8ke/ZIe7wHEjMjKaQ7z9b/QQKye+zFz9B/RQ2uWKI+HFvER4CpspmFd0szTMYgU ZPQQs1GgXRMvPiaYK3iMM5m/3Q315BeqEZAFnJmVUnbWriPAPnQBtIWEMtyQW8zx4Ix2 h75YPcWPnKY5S8sqLgiOPm9io60Uf4hT6pqNHS+YMNKeItD6KB5lhd8jko4AETZesJj3 YoZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xZvslDl1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1247035ejx.417.2020.09.17.20.09.18; Thu, 17 Sep 2020 20:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xZvslDl1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727419AbgIRDHL (ORCPT + 99 others); Thu, 17 Sep 2020 23:07:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:50610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbgIRCDv (ORCPT ); Thu, 17 Sep 2020 22:03:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF44023770; Fri, 18 Sep 2020 02:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394631; bh=FH1ZAFozw3UmdYRa+SC+Sc5mujLG3AFb2GJovZPNwD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xZvslDl1zhgJiZOAwN8ld35R4KJFI9hI4Tbd8TkHhJK1KscDQIq366GtKifTgIgq3 HgciS4/kBV4rraRT4ML8ci9NkWriveJNlGEOMAeaI2xCZzEFcdI1QCRZBdq1bubX4m lcSS3VKlO3wFKg7jruRYPNi7DyafKdkNs+l4+GiU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.4 131/330] ALSA: usb-audio: Don't create a mixer element with bogus volume range Date: Thu, 17 Sep 2020 21:57:51 -0400 Message-Id: <20200918020110.2063155-131-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit e9a0ef0b5ddcbc0d56c65aefc0f18d16e6f71207 ] Some USB-audio descriptors provide a bogus volume range (e.g. volume min and max are identical), which confuses user-space. This patch makes the driver skipping such a control element. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206221 Link: https://lore.kernel.org/r/20200214144928.23628-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/mixer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 9079c380228fc..8aa96ed0b1b56 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1684,6 +1684,16 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer, /* get min/max values */ get_min_max_with_quirks(cval, 0, kctl); + /* skip a bogus volume range */ + if (cval->max <= cval->min) { + usb_audio_dbg(mixer->chip, + "[%d] FU [%s] skipped due to invalid volume\n", + cval->head.id, kctl->id.name); + snd_ctl_free_one(kctl); + return; + } + + if (control == UAC_FU_VOLUME) { check_mapped_dB(map, cval); if (cval->dBmin < cval->dBmax || !cval->initialized) { -- 2.25.1