Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp70016pxb; Mon, 13 Sep 2021 13:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/YQxPpoSucMJn5mUG22612qc46sx8TYZVZFbHYwGhz8VdoUn79MbL3Jy51+wtOXJGW4gp X-Received: by 2002:aa7:c617:: with SMTP id h23mr13616647edq.357.1631563921534; Mon, 13 Sep 2021 13:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563921; cv=none; d=google.com; s=arc-20160816; b=SXyak3LVgeJnaEeEtiwP7OFSfoMknzYCOl+lX9SBXJ2LXOIvFQwP+Ho+bJc19cZoc5 Pr0o3CHQUsc9jUdTxbAGgmsiaanyFkHhKDzp0ibdNEevgaIph/U/RKsXIesPXmGTTKN0 xia9/Rh3hdq80tVvu+Veto6F24/GY0DW3Qg/RFlayEa4m9ZzZvRmNyacXxgHNR1Xnmaa /yDI1u2da9A/swJKT4JBb45l4s6B2LnzafEf88mBguEz4yo5HrUT38VZOzjNd5IhQCOY //nHzZeH3YiZjzaGmvacyCgeyYJ0fFpbwcmRk3AVNvJnW43DrWwHbWzZLy8My86mIzNQ Ka5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TXpkCkwmckMrHiBITB4Rzr86uSlA2g0co/5s9AryrYo=; b=Vudp9TiUN96cFR72Xe3YSm8R4r0fYUoW+MDrzcNNWnEj6IvuKwSNbFM9A/v+KXB6hR J/b8+7DbtAEAqVK10DDHyO2k+Dzc04GFno8W6q1PLHb0ZS2I3nQRHnkNINKmvf1cI6qd +j/45FOHUBW/VRvIBt2X1wxGBR/cFoAFwX4TsAHECNVr98OgGeXq6g2JzOZJRsdL0fwa XX22C0vGlK6SA5TzQLvSg0rM50k8HzV+KsTNVPk+Nk11jdAan3NgR8Ew0e+jbC6VnNQg Ic0uPaqnzY+Mepr3Llu1Rsi14UkyT2heIaZv7uKU6zMGAm+VYsjMaEoV8K8kJIFWIiFd J23g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lagLPWma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si8263346eds.576.2021.09.13.13.11.35; Mon, 13 Sep 2021 13:12:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lagLPWma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244250AbhIMNtQ (ORCPT + 99 others); Mon, 13 Sep 2021 09:49:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:49324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243756AbhIMNoy (ORCPT ); Mon, 13 Sep 2021 09:44:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E3BE7610CE; Mon, 13 Sep 2021 13:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539884; bh=TgCLmv4iU0PqBKcaK82CjsboDReFW42E1rXJzrpRNE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lagLPWmaa+44zf7xO1VnKzH7Z+sY+ZsfQ1r/MsDHZZEnNJy+4xEMjoFYC5UCo6JcH o/hdJ535STPRv3H7qEdTkP4bepBG3yWFJUoxCR3xs41HqsHDCrutojj0YBrLl8yh3H Clgg/kj4liiRQyUmCx/FnRZloWD0XtJwKxKFCjBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.10 198/236] ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function Date: Mon, 13 Sep 2021 15:15:03 +0200 Message-Id: <20210913131107.119091402@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit fc6fc81caa63900cef9ebb8b2e365c3ed5a9effb ] If 'wcd9335_setup_irqs()' fails, me must release the memory allocated in 'wcd_clsh_ctrl_alloc()', as already done in the remove function. Add an error handling path and the missing 'wcd_clsh_ctrl_free()' call. Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec") Signed-off-by: Christophe JAILLET Message-Id: <6dc12372f09fabb70bf05941dbe6a1382dc93e43.1629091028.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wcd9335.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 0b7aae5cc783..7f758728f403 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -4844,6 +4844,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component) static int wcd9335_codec_probe(struct snd_soc_component *component) { struct wcd9335_codec *wcd = dev_get_drvdata(component->dev); + int ret; int i; snd_soc_component_init_regmap(component, wcd->regmap); @@ -4861,7 +4862,15 @@ static int wcd9335_codec_probe(struct snd_soc_component *component) for (i = 0; i < NUM_CODEC_DAIS; i++) INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list); - return wcd9335_setup_irqs(wcd); + ret = wcd9335_setup_irqs(wcd); + if (ret) + goto free_clsh_ctrl; + + return 0; + +free_clsh_ctrl: + wcd_clsh_ctrl_free(wcd->clsh_ctrl); + return ret; } static void wcd9335_codec_remove(struct snd_soc_component *comp) -- 2.30.2