From patchwork Thu Mar 31 11:47:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 12797000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19632C433EF for ; Thu, 31 Mar 2022 11:49:08 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B390A18A8; Thu, 31 Mar 2022 13:48:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B390A18A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648727346; bh=zLyV51MFGb7lHLqT0TvbSmI+u5TpyINqhr9H9jsDu+4=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=Hy5T26jqQBRe8ugKkv57sb2z3rOGWwfQjU7VogVuemKyQJb85H5Uj4MvqSdHIMQNC pt+DItI4E6Bz8WSWgTp5BCuzf6R0ZLklm4joIqQio+9enhMWLa0v5j5zW3Vko12nSo Hs4bS0SgSMeEb0lOiP8Tg407ttuk/7KRlsMbICJA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4506EF8020D; Thu, 31 Mar 2022 13:48:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D5347F80227; Thu, 31 Mar 2022 13:48:14 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1840BF800B8 for ; Thu, 31 Mar 2022 13:48:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1840BF800B8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="feN+lQMn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648727289; x=1680263289; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zLyV51MFGb7lHLqT0TvbSmI+u5TpyINqhr9H9jsDu+4=; b=feN+lQMnd5lWaNo3Q65SDWUYnFBwNa2Zmi/wgaF/LJ0xrI5Fc9+2pZrN LZu264CSpsVCMBTSQ9Lo2FjuNlXL2LeI73EqfrgDt7MtJIfwDyOpqjvks opMvaojLeFYcg9CSA2i/MH6hYH3+AghQItDELA7v0Eu3S5c3pga2jxu1a Pq3n1AHsNkwJurW0Vlifv/ornDFGgNBBk+EgoaWfsdrU/wiheQPoLqsBk AVpQJETp38MEo8WHj9IbtzH+y6gAZtv5BP0b/LiTOpBGaKW6QYqDs9K2O YwM8I70OmUFhNM7G2Gh19ifgCUJazqR7Oe9XH4iFCjem9l21HoiX07Dxl A==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322986852" X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="322986852" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 04:47:44 -0700 X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="547294166" Received: from dmmatarr-mobl1.amr.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.249.43.22]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 04:47:42 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com Subject: [PATCH] ASoC: SOF: ipc3-topology: Set scontrol->priv to NULL after freeing it Date: Thu, 31 Mar 2022 14:47:57 +0300 Message-Id: <20220331114757.32551-1-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Since the scontrol->priv is freed up during load operation it should be set to NULL to be safe against double freeing attempt. Fixes: b5cee8feb1d48 ("ASoC: SOF: topology: Make control parsing IPC agnostic") Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/ipc3-topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 2f8450a8c0a1..2e1c76ed087d 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1592,6 +1592,7 @@ static int sof_ipc3_control_load_bytes(struct snd_sof_dev *sdev, struct snd_sof_ if (scontrol->priv_size > 0) { memcpy(cdata->data, scontrol->priv, scontrol->priv_size); kfree(scontrol->priv); + scontrol->priv = NULL; if (cdata->data->magic != SOF_ABI_MAGIC) { dev_err(sdev->dev, "Wrong ABI magic 0x%08x.\n", cdata->data->magic);