Received: by 10.213.65.68 with SMTP id h4csp506904imn; Fri, 16 Mar 2018 09:51:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELurXmCY6lZqVMJ/DvhiiK7iGJCw1mbnbDCarc6UPiuRfXX2V+XBlhqo9nDeDIVJhuFjiWBa X-Received: by 10.99.170.5 with SMTP id e5mr1932196pgf.92.1521219060741; Fri, 16 Mar 2018 09:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521219060; cv=none; d=google.com; s=arc-20160816; b=fgs3SAps6AOS4YCvN70gK+RVtmN9TV1NZa3+yMJlHrZEviR7avxGGsPGAd+/e+N0n5 FHJO0sfz8pBwVUSNSv00GlBO4kcGbYOqwrr3BoyOV55uhQPZ6FAhn2mRCo/WY/ff+tx3 c9RDucGxIfhsqs+8LcxymshNQ6/Q3V7KNqtPsXCcAe6foVFRlb1ott+TUNlCsybN+Zme eFTQVamIuIDSUqAQnNvPzigwrjDDQ98KzTrOTZG4TXTe/F2ELJQBg2j/lUlAscTDmd3E +lnRAwhxkNCXxVg+Dc5Yxaa//CTuO6hUgAalWdWsmUfd6WRNCKpKoEEG5YWFu56tTkhx a1hA== 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=nPhYOmG/VBmztX0WnbEtEhVhUos3nR0Ll3WGvoqBILo=; b=gISmsXld2a5n6ovOnNZLXMGrgJq5hodlmbpETj8TdYa+2Uv0IGqLLKjYjLN1e7dN+g rRUzA0ypUqc9lyGXHUmLu5gF+UepEVEIQAJ9dV4z+l1sysiXkOzb+ZzFWhGOEB+EZTk8 8/lQkBcK3374mOkOHq/Zgt5+8WBfy+4hBfRUzdGyekcP1/JhPbmWsfk3ED35ryGHUDYL 7Q9z2+lo/esq2cveac0TD6y2SdBClfaNWdYNjAj2sUQvBnP3SBTLbjMMmfUby2jxnWt2 DeeO6jBSnE2/QvyQm6Xj+m37JLP9JE4l4nFplo518sp/kgkDFjv5Vb8OUSQukxJzATHG 20HA== 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 v6-v6si6446993plg.618.2018.03.16.09.50.46; Fri, 16 Mar 2018 09:51:00 -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 S1752795AbeCPQta (ORCPT + 99 others); Fri, 16 Mar 2018 12:49:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39696 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934065AbeCPPfD (ORCPT ); Fri, 16 Mar 2018 11:35:03 -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 4813E1065; Fri, 16 Mar 2018 15:35:02 +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.14 006/109] ASoC: wm_adsp: For TLV controls only register TLV get/set Date: Fri, 16 Mar 2018 16:22:35 +0100 Message-Id: <20180316152330.179436218@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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; }