From patchwork Mon Mar 19 08:08:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 132021 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2435195ljb; Mon, 19 Mar 2018 01:09:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELuOAVZRKizswWXvds5N8MwYOZsp2ytTMGUsdhS4owAPpVZXMbLGltpXM5NLmBPLzqfUJeqG X-Received: by 10.28.125.194 with SMTP id y185mr2947449wmc.160.1521446950827; Mon, 19 Mar 2018 01:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521446950; cv=none; d=google.com; s=arc-20160816; b=gxwmgM9RahhhjBF7mVqXOg8YEWf1gqYxBIxV/8hLBnjv+Os+3oS/RcLv8ZdOvEt2LW El7EmnDQfXe2BHSxUL+v4nxx4ERqgPoom/y9JvqyF4ZZk+5hFxaDNzG6ckZmKn7MOK0q nLkrrsDG2NFBkxcFW8tRDNpGnqoYQsQRiUQIMFQhYjsngqW+u6zOp4UpRdqV2sBuaWf7 bxPg+t5SnTZMa/NErYWchJ/Q1PpHj2GWqgzxmhMebUa10C7ONZ1DJJk09lJXJfFrA5jD mlNo8kHsSDiyLX1Ybcp9sdAN1Frxgfr8TIPpLyQqpnB7EgAjB9M37mwbL0D7thpMHpKL tMAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=opyNQqwRTJYznbFCXRFjaWcfIp1EBBDtcSywk37OVxI=; b=gFEnxkSCQQVAYnBu94D/uciN8evA0yRvcSXvkmEcxuXb00/YoliJT7GHBVoWwKDeME NEzBn+cgShdOhB9wfZswOEsFMfXXJDJ+SWpFvRTmkoTdjJ9gdhYUCIqDCuCqHmwdS/aW WAeir0EF+iK1/doG10zcPLHtq36iZdmVRUorLUC2BbsmHhKP4CUxtcfiySBtkk3Z0bOL JR2XdxBbDyYxRqM31XrPwsBopDFGaUrPrkLKqYRJOrgl1c+cLfqnF0+8JXhaPIPmFWQ8 iNwrHxSMOH6mRy/PO3ubrMAbTGaBnLRtN+v/yS6tDeLdHSFZECR2oIBdMgtsXcgkDNb9 dMJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=jYS2jiWl; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id w74si8015250wmf.76.2018.03.19.01.09.10; Mon, 19 Mar 2018 01:09:10 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=jYS2jiWl; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D5DC226739D; Mon, 19 Mar 2018 09:09:08 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5BAFD26739D; Mon, 19 Mar 2018 09:09:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 51B552672C0 for ; Mon, 19 Mar 2018 09:09:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=QklsmaCNB/nAs+sUwxAA62bmLtxpLVpwCoMG+ANsJa0=; b=jYS2jiWlufHo Dl9dIB0N3xvW4yioc4gGFCiQUgo/fDWwGN4Nrz8FU4le0qZkYUgL1s2klp0OSPc5EwfA4QDTLT59D bZbxvzCBm41qJFpT1bxu0NOXzuR21r4Ix9GcM9azxog3r3Eoe67Cl+hWXvSNr4IaC/YwQliWWu2sS mTdQI=; Received: from [218.255.99.6] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1expqo-0006Lz-2m; Mon, 19 Mar 2018 08:09:02 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id AA52144007A; Mon, 19 Mar 2018 08:08:58 +0000 (GMT) From: Mark Brown To: Liam Girdwood In-Reply-To: <20180314204240.13848-1-liam.r.girdwood@linux.intel.com> Message-Id: <20180319080858.AA52144007A@finisterre.ee.mobilebroadband> Date: Mon, 19 Mar 2018 08:08:58 +0000 (GMT) Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: topology: Check widget kcontrols before deref." to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: topology: Check widget kcontrols before deref. has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 05bdcf12905533b8628627b6634608cd3b57c607 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 14 Mar 2018 20:42:40 +0000 Subject: [PATCH] ASoC: topology: Check widget kcontrols before deref. Validate the topology input before we dereference the pointer. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-topology.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index e81b52600d58..b363f2409f72 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -504,6 +504,9 @@ static void remove_widget(struct snd_soc_component *comp, if (dobj->ops && dobj->ops->widget_unload) dobj->ops->widget_unload(comp, dobj); + if (!w->kcontrols) + goto free_news; + /* * Dynamic Widgets either have 1..N enum kcontrols or mixers. * The enum may either have an array of values or strings. @@ -524,7 +527,6 @@ static void remove_widget(struct snd_soc_component *comp, kfree(se); } - kfree(w->kcontrol_news); } else { /* volume mixer or bytes controls */ for (i = 0; i < w->num_kcontrols; i++) { @@ -541,8 +543,11 @@ static void remove_widget(struct snd_soc_component *comp, kfree((void *)kcontrol->private_value); snd_ctl_remove(card, kcontrol); } - kfree(w->kcontrol_news); } + +free_news: + kfree(w->kcontrol_news); + /* widget w is freed by soc-dapm.c */ }