Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BC09C433E1 for ; Wed, 26 Aug 2020 00:01:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A67ED206E3 for ; Wed, 26 Aug 2020 00:01:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="DWLYOQ11" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A67ED206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 310EC16F6; Wed, 26 Aug 2020 02:00:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 310EC16F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1598400105; bh=4Y1j689QgzdbOGnyFYssL2GyGI1DoDVb0jbh03ESaxA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DWLYOQ118kdIgAMHQ3je/HCzaxyTXcez2/aBAI+XdaYYcq2/pRTfXH+k/gSbusRE0 +3uq+ysw5lyyRqumdDpyoRMrbY/pvg9ORsI/6MFt1WISah+3U/xDKx/rGQ3RCwi6xK NxjYEf1mEQqU4gDTXv8key+9mYTcdbisow1RFx/4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D053CF802BC; Wed, 26 Aug 2020 01:59:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ABD64F802C2; Wed, 26 Aug 2020 01:59:19 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 19C9DF80143 for ; Wed, 26 Aug 2020 01:59:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 19C9DF80143 IronPort-SDR: v0Oc+k9A8/6tRnNJq1cFEuPCsDhbs4D6pDYDLyWP6W59mQKEMxJY64qg6x22ix+afz9hOd3dMx t+m6ZMoJjIzw== X-IronPort-AV: E=McAfee;i="6000,8403,9724"; a="135764551" X-IronPort-AV: E=Sophos;i="5.76,354,1592895600"; d="scan'208";a="135764551" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 16:59:04 -0700 IronPort-SDR: 18SvDN6Qir/t8wxDQlKudvcW6F0Um6rWJmjbxMYGDmju7jVAfQYJiiQ0fL9WQsiAwPgZjE+jAv 8fijXQRKFojg== X-IronPort-AV: E=Sophos;i="5.76,354,1592895600"; d="scan'208";a="474558907" Received: from cdurvasu-mobl2.amr.corp.intel.com (HELO localhost.localdomain) ([10.209.42.42]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 16:59:03 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 2/4] ASoC: SOF: loader: fix memory leak in get_ext_windows Date: Tue, 25 Aug 2020 16:58:52 -0700 Message-Id: <20200825235854.1588034-3-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200825235854.1588034-1-ranjani.sridharan@linux.intel.com> References: <20200825235854.1588034-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Guennadi Liakhovetski , Daniel Baluta , Kai Vehmanen , tiwai@suse.de, Pierre-Louis Bossart , Ranjani Sridharan , broonie@kernel.org, Karol Trzcinski , Bard Liao , Rander Wang 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" From: Pierre-Louis Bossart sdev->info_window is allocated with kmemdup and never freed, use devm_ version since this is only used for first boot. Fixes: 8d809c15acf23 ('ASoC: SOF: ext_manifest: parse windows') Cc: Karol Trzcinski Signed-off-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Reviewed-by: Kai Vehmanen Reviewed-by: Rander Wang Reviewed-by: Guennadi Liakhovetski Reviewed-by: Bard Liao Signed-off-by: Ranjani Sridharan --- sound/soc/sof/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c index 25dc28ebafb7..42e0e3e58869 100644 --- a/sound/soc/sof/loader.c +++ b/sound/soc/sof/loader.c @@ -33,7 +33,8 @@ static int get_ext_windows(struct snd_sof_dev *sdev, } /* keep a local copy of the data */ - sdev->info_window = kmemdup(w, ext_hdr->hdr.size, GFP_KERNEL); + sdev->info_window = devm_kmemdup(sdev->dev, w, ext_hdr->hdr.size, + GFP_KERNEL); if (!sdev->info_window) return -ENOMEM; -- 2.25.1