Received: by 10.213.65.68 with SMTP id h4csp469330imn; Fri, 16 Mar 2018 08:42:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELsBy0KTfUDRRKQZ80tD2LnWBb7IU21KrdzRO6hGV21YGg98WxJgXCrecTfI8y6K9exqeYxg X-Received: by 10.101.65.11 with SMTP id w11mr1778411pgp.186.1521214930488; Fri, 16 Mar 2018 08:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521214930; cv=none; d=google.com; s=arc-20160816; b=u5uD/AhoeXhnU+85rohGgWwJVO0/0fyj33svGZ6ZaxGpDQSeqXXVuibEATBwe6prrj pvOuz5f3bbYmUZxVzXuQYTzTdE3qbZZnnh7iak/ynOSpJuG6DMKKZQc7als+qqoDn9TQ qsvoReDX4d/p6ft8H2eIy6jqfLoHhfBXOKr6OrGKg9dkyWrsRh1DkiTTjw1XpCBlkoUt 8wSolLh1o9qXvgMZN4GppISVyr3MaWvR70NpnBs8Z0Fu+vsNIfm8CTWBblMplJqcLX1R NvkyNSp/SkmLq5NNdxCVPknof2K6VJQrMUqKzc4oHCcXHKI+tarEFsC1rxKLDatUdkHv 9YaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=eNeAsf+V/Qv0/NhgMz1rmUKVN11agHSHdiRr2NHp64A=; b=ezbDqyg+CsHYrjVaxdkQYPNKT64iCEH5lb8bdDb3a/1R+x/2PDDiWZ7a4TPnHzXBWR jTiVIpCQ1wVWvlvj6oQYs/i/j/IU3DNRY1FDzt8J5pfBM6ggpjJqUmfej1NNyCZ+QdEC arU+HSdW1fgPazUDQRxtk1nJ9UIh+OdiVcIDieKRZYH3lpro7+xREiWQ34y0JwY2m4Se FVQLghGMn8NL4CJNr94iq4q9wevZ17TJ/vba5bopQw9pNnT+Q+i6fJlKQC8JPMUTVG8Y bFxAslPIM1ZvZPk1B7ZsdtFffPs4cPaHLI29RlSp6VBwI5rKM5ZGdSV0Bs5ObfnGy1cd Dd7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20-v6si4476946plj.748.2018.03.16.08.41.56; Fri, 16 Mar 2018 08:42:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965125AbeCPPky (ORCPT + 99 others); Fri, 16 Mar 2018 11:40:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43752 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965099AbeCPPkp (ORCPT ); Fri, 16 Mar 2018 11:40:45 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EDF71E7A; Fri, 16 Mar 2018 15:40:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Fitzgerald , Mark Brown Subject: [PATCH 4.15 004/128] ASoC: wm_adsp: For TLV controls only register TLV get/set Date: Fri, 16 Mar 2018 16:22:25 +0100 Message-Id: <20180316152336.430113758@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Fitzgerald commit d7789f5bcdb298c4a302db471b1b20f74a20de95 upstream. Normal 512-byte get/set of a TLV isn't supported but we were registering the normal get/set anyway and relying on omitting the SNDRV_CTL_ELEM_ACCESS_[READ|WRITE] flags to prevent them being called. Trouble is if this gets broken in the core ALSA code - as it has been since at least 4.14 - the standard get/set can be called unexpectedly and corrupt memory. There's no point providing functions that won't be called and it's a trivial change. The benefit is that if the ALSA core gets broken again we get a big fat immediate NULL dereference instead of a memory corruption timebomb. Signed-off-by: Richard Fitzgerald Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/wm_adsp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -1204,12 +1204,14 @@ static int wmfw_add_ctl(struct wm_adsp * kcontrol->put = wm_coeff_put_acked; break; default: - kcontrol->get = wm_coeff_get; - kcontrol->put = wm_coeff_put; - - ctl->bytes_ext.max = ctl->len; - ctl->bytes_ext.get = wm_coeff_tlv_get; - ctl->bytes_ext.put = wm_coeff_tlv_put; + if (kcontrol->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { + ctl->bytes_ext.max = ctl->len; + ctl->bytes_ext.get = wm_coeff_tlv_get; + ctl->bytes_ext.put = wm_coeff_tlv_put; + } else { + kcontrol->get = wm_coeff_get; + kcontrol->put = wm_coeff_put; + } break; }