Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp259610pxx; Wed, 28 Oct 2020 04:20:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaAcUdLCavzLd6DxO9qWZAfS3oYqFGAKxlt0oVxbu/+pGet3fnQTvOm+5Y6J2Hjq6Ogu0S X-Received: by 2002:a50:da8d:: with SMTP id q13mr7342355edj.370.1603884042967; Wed, 28 Oct 2020 04:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603884042; cv=none; d=google.com; s=arc-20160816; b=kIhsad+z4vpbpYGyeUzwZucGH1oK1GT3mjj6dCyWkL6HR0twYLGMTJckqh0qoIAV3m YCV32uxQoknVWTWPTLmx9nyLwuOSVqQ5bZSLJbKxc/es/51Pc9oOej30NK8VCO1bl2/N GDtAsCINQfR2Aq3/rtK9wKCzcM7M5ZgnjMbOS9pmBxj0Lae9W0ObJ8mqAkh4iZHCig/T 4JhnyaOgapytZkwIghGhKC70dwuibKNhCEhggvHI7+yxhzOhwlSoEGVQF3TRDS5DFwy5 O0g93YSXsFmbC5VHds7HRhlB5Btusv+VK14rJts+VPJYoV4vivowbFL2+SAQScqD6CiJ Qk7w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ool1JN0l61iHUlsaWRyq7IOR1DECIAaQ19k2WU2GiNo=; b=d6YJ8gGJk+uTWmcs+fLe6C5GhI8xVCmrpbqfIliO3iwtx6huWSkKFGKJ5+yqSaTGCo rXFy52XevQQf4PNiLMOQ0qIJhvt8adSqUYjFn1trqrP1Nj/mBLZHSjL0dtkGxNoUMM/E 3mG8C2tOe07dteuH04sAxGv1qtSICxM7W9QoJSvr+AiFd1x/Q1HVid2+3JYEnA2jHecl krMMTIXLxnb6ISH2Ry51SWcH6fYP9qFos7xW4Rj5JEz6iTgPh2MZ5/hYNRDyW4TZgzJt Ca17TQlSityux4QZ+myktMP4eNlI+ZUIRUJdvfetz1s3Bk0LxktoUC/RqlwtndG1RJLK ogRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfeGH9kn; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si2879649ejg.48.2020.10.28.04.20.21; Wed, 28 Oct 2020 04:20:42 -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=RfeGH9kn; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1788939AbgJ0PBY (ORCPT + 99 others); Tue, 27 Oct 2020 11:01:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:59168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1783233AbgJ0O6B (ORCPT ); Tue, 27 Oct 2020 10:58:01 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66C2020780; Tue, 27 Oct 2020 14:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810680; bh=DCgQ9rO8eT5AKp6LgqlnZWOe584uEltQyBx8h0ap0CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfeGH9knrC68sVqnyf2zK2s9wpNm8/xbxKbERcIr8JUSnJzPMC5U5kB1EJYKzwAaF AGIcKBnEExq1wenkzIm14XC9npsdqDNMqih7sYOZ7oXiROtIu9g/zJL5NfKTJ4lSik bssZ1elN0FuYWqLK9w4sbU8l+A7rcUmS4fmTuG7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Pierre-Louis Bossart , Ranjani Sridharan , Bard Liao , Jaska Uimonen , Kai Vehmanen , Mark Brown , Sasha Levin Subject: [PATCH 5.8 226/633] ASoC: topology: disable size checks for bytes_ext controls if needed Date: Tue, 27 Oct 2020 14:49:29 +0100 Message-Id: <20201027135533.284609954@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart [ Upstream commit 6788fc1a66a0c1d1cec7a0f84f94b517eae8611c ] When CONFIG_SND_CTL_VALIDATION is set, accesses to extended bytes control generate spurious error messages when the size exceeds 512 bytes, such as [ 11.224223] sof_sdw sof_sdw: control 2:0:0:EQIIR5.0 eqiir_coef_5:0: invalid count 1024 In addition the error check returns -EINVAL which has the nasty side effect of preventing applications accessing controls from working, e.g. root@plb:~# alsamixer cannot load mixer controls: Invalid argument It's agreed that the control interface has been abused since 2014, but forcing a check should not prevent existing solutions from working. This patch skips the checks conditionally if CONFIG_SND_CTL_VALIDATION is set and the byte array provided by topology is > 512. This preserves the checks for all other cases. Fixes: 1a3232d2f61d2 ('ASoC: topology: Add support for TLV bytes controls') BugLink: https://github.com/thesofproject/linux/issues/2430 Reported-by: Takashi Iwai Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Jaska Uimonen Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20200917103912.2565907-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-topology.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 6eaa00c210117..a5460155b3f64 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -592,6 +592,17 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, k->info = snd_soc_bytes_info_ext; k->tlv.c = snd_soc_bytes_tlv_callback; + /* + * When a topology-based implementation abuses the + * control interface and uses bytes_ext controls of + * more than 512 bytes, we need to disable the size + * checks, otherwise accesses to such controls will + * return an -EINVAL error and prevent the card from + * being configured. + */ + if (IS_ENABLED(CONFIG_SND_CTL_VALIDATION) && sbe->max > 512) + k->access |= SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK; + ext_ops = tplg->bytes_ext_ops; num_ops = tplg->bytes_ext_ops_count; for (i = 0; i < num_ops; i++) { -- 2.25.1