Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp661832ybh; Tue, 10 Mar 2020 06:05:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvtv0q5dTs/H5iQ+iJxOyYvzgltg+oLAoYUXoAfp2/9LhrTmtpkswDk/S5B3JjkC136K/js X-Received: by 2002:a05:6830:1447:: with SMTP id w7mr3482563otp.267.1583845516916; Tue, 10 Mar 2020 06:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583845516; cv=none; d=google.com; s=arc-20160816; b=pTDMqMKLlqRZCBIdJMlMuiMU/cZ1+FspEzOl2cr5gMVIio8ipicHZgPu7NOnaNv86d p4i9gaPFpjvjKa3KX87uFBOfLOnUk8YkiRKBOcbZy2Giy+H9OHbFolKnyw/+T2n0H9Ff DJ0qz8U2xvQDcCulYwshuBGHVvIW8Fb7L5Vj7o3swGGIRPzfI2feB9YArqImSRTxmZV8 kn5U7YGm3NnNWO50ZztwLnKOr9QaFEYtx4hFseQ05NmpVZlJaZFZtim3aq1lrtqv4/Nb mD3VKZk4ztBQAWlpqH0doz3dV5rC9+uBjgL7MTDcR4T7QJ6n9lvczMwiYTNTdhyRmfK/ T4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=keCyxidoyaUMu2S2e+js7W0H5T0ZugCh+MZQmD5Mgl8=; b=nSOlTq5B/wzErIAcipkC/02T5sEyqcNsHK9pvOefHofkMFrdU2LG/+BxNFeE0UFxm4 GKaxiTtMCS5lEvs1Gdk5tepmNOKAqsUqbJdqDFl9O1Q4X138UuPWxswI5gkNo7dZ05XH irNgy5EPa5Cz10Spj9D3dpUZyXiofxBdfR74U+XwXhush8eMQAVa3kgGOWfgF1+EKkIV plXqhrmD+IGFsoJQRjP4JkEZr9uvImBxWU3duOhhRMDq6EegR7wuGSPv6nsvl7oC+row eStbRw623wOfOoJ9RrWdq+HtaeyuFGYZXNX2pVieTlk+FKzfP+sLAeRnZDnA1j7jMMGu GPqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nMDPxwWI; 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 g25si8786342oti.250.2020.03.10.06.04.43; Tue, 10 Mar 2020 06:05:16 -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; dkim=pass header.i=@kernel.org header.s=default header.b=nMDPxwWI; 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 S1730284AbgCJNBh (ORCPT + 99 others); Tue, 10 Mar 2020 09:01:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:42778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730269AbgCJNBa (ORCPT ); Tue, 10 Mar 2020 09:01:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B640324649; Tue, 10 Mar 2020 13:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583845290; bh=TCnicF+IulriJkqk77wcgKGaA9yvCkJFj5VIQHJujAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMDPxwWINuwGmDm+ddn6/Kom31LBjQ28jsVStW2guZTJoWNME613fL+cO5cwF1sNY pXim7lZkhS915GoaXeZme6FtypKKW1cYUOo9aiPHYgBxb0E50Ug2VCASD6KLYEfdcw EN31TV6jgmSEq4BAX1oFXUOvzh8KYi0njuc9nqqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dragos Tarcatu , Mark Brown Subject: [PATCH 5.5 131/189] ASoC: topology: Fix memleak in soc_tplg_manifest_load() Date: Tue, 10 Mar 2020 13:39:28 +0100 Message-Id: <20200310123653.062370320@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123639.608886314@linuxfoundation.org> References: <20200310123639.608886314@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dragos Tarcatu commit 242c46c023610dbc0213fc8fb6b71eb836bc5d95 upstream. In case of ABI version mismatch, _manifest needs to be freed as it is just a copy of the original topology manifest. However, if a driver manifest handler is defined, that would get executed and the cleanup is never reached. Fix that by getting the return status of manifest() instead of returning directly. Fixes: 583958fa2e52 ("ASoC: topology: Make manifest backward compatible from ABI v4") Signed-off-by: Dragos Tarcatu Link: https://lore.kernel.org/r/20200207185325.22320-3-dragos_tarcatu@mentor.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/soc-topology.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2503,7 +2503,7 @@ static int soc_tplg_manifest_load(struct { struct snd_soc_tplg_manifest *manifest, *_manifest; bool abi_match; - int err; + int ret = 0; if (tplg->pass != SOC_TPLG_PASS_MANIFEST) return 0; @@ -2516,19 +2516,19 @@ static int soc_tplg_manifest_load(struct _manifest = manifest; } else { abi_match = false; - err = manifest_new_ver(tplg, manifest, &_manifest); - if (err < 0) - return err; + ret = manifest_new_ver(tplg, manifest, &_manifest); + if (ret < 0) + return ret; } /* pass control to component driver for optional further init */ if (tplg->comp && tplg->ops && tplg->ops->manifest) - return tplg->ops->manifest(tplg->comp, tplg->index, _manifest); + ret = tplg->ops->manifest(tplg->comp, tplg->index, _manifest); if (!abi_match) /* free the duplicated one */ kfree(_manifest); - return 0; + return ret; } /* validate header magic, size and type */