Message ID | 2b4bc0b22fac32ab3a7262240019486804c1691f.1673806409.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp858144wrn; Sun, 15 Jan 2023 10:39:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXtlDBpP7SsPkkbs26G6a7PBHckR69x/DWbKq/XxAclx54RYkyTsFCRK7aIQg0Vnc1vmMF6x X-Received: by 2002:a17:90b:2544:b0:228:cf3a:9e86 with SMTP id nw4-20020a17090b254400b00228cf3a9e86mr18930440pjb.23.1673807955773; Sun, 15 Jan 2023 10:39:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673807955; cv=none; d=google.com; s=arc-20160816; b=D6Lkbg4eykNG62PQq8Ex3WLMDvlZlMDapokXbwKooRs/nAEa+cYlCZaypZA4E6owF+ zm03Gp+LD8B+I+zcrRjASEC22HxDHLXocsp4me/YXrMXGVhUz1KxOqiNcwLw8XNdtlwQ V+LZ9FqBBkvTZPdv++gtCC1kCr0otn71v5A9EpXYRMt2Vod4FTLUxSIM+tRD5/Ehanzn rooHMigfVVmNqRoi/u2uqVAR7S49YrwEF7N5hdK/7rocL+2g91h9FLUNf5SYpFUsLf3H 6fLTflWFjCKC6O/aEqi5cQ+9Pa9OlqUsyJnRWYxKyDXrxRFZDx1Nw+xwfXFOunJ2xsqb YJFA== 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 :message-id:date:subject:cc:to:from; bh=RGlS7mFGxsQnJI37EfldTev+GzcXhTcQUayH/QDJX9w=; b=VElyAawGNwvqMFmZ7L8fSxS239v8EF3y5liEXhS1lCyb57QWo5dUbOhTSrwiz8CFVm 2xFN3smKvMm09Ro38oSibB/ZfcuIe2tnvuVYZCevIDSfsUOeAX9X6CrKrl2zCplTvm3A 1E82g4FzUp5KAv8TBge3hkAWK5EE5FheJjd1AXvQVseS/HgjP0Bna2xTAc/4urKuIt7i EITNCInqpNdOwqSoSD1ILmx04kGYv8BZtBMspvXQobCJjcS0b2gZM615L5XAs+LqcNsu bEwHI686IFtzj98Ice9dkkut+ZlmEVQHuIha4B2lZ6jNminN6KrhprLIHZrsqY/vRLdv XCJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b23-20020a17090a991700b002239c987051si25485918pjp.128.2023.01.15.10.39.03; Sun, 15 Jan 2023 10:39:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbjAOSN4 (ORCPT <rfc822;stefanalexe802@gmail.com> + 99 others); Sun, 15 Jan 2023 13:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230508AbjAOSNz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 15 Jan 2023 13:13:55 -0500 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40124EC70 for <linux-kernel@vger.kernel.org>; Sun, 15 Jan 2023 10:13:53 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id H7VtpuQKibLr1H7VtpQ63o; Sun, 15 Jan 2023 19:13:51 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 15 Jan 2023 19:13:51 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Daniel Baluta <daniel.baluta@nxp.com>, Paul Olaru <paul.olaru@nxp.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-arm-kernel@lists.infradead.org Subject: [PATCH] firmware: imx-dsp: Fix an error handling path in imx_dsp_setup_channels() Date: Sun, 15 Jan 2023 19:13:46 +0100 Message-Id: <2b4bc0b22fac32ab3a7262240019486804c1691f.1673806409.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755114850762525282?= X-GMAIL-MSGID: =?utf-8?q?1755114850762525282?= |
Series |
firmware: imx-dsp: Fix an error handling path in imx_dsp_setup_channels()
|
|
Commit Message
Christophe JAILLET
Jan. 15, 2023, 6:13 p.m. UTC
If mbox_request_channel_byname() fails, the memory allocated a few lines
above still need to be freed before going to the error handling path.
Fixes: 046326989a18 ("firmware: imx: Save channel name for further use")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
The Fixes tag is not really accurate, the issue was already there before,
with other emory leaks.
However, I think that the Fixes tag above is much more logical.
Feel free to update!
---
drivers/firmware/imx/imx-dsp.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Sun, Jan 15, 2023 at 8:35 PM Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > > If mbox_request_channel_byname() fails, the memory allocated a few lines > above still need to be freed before going to the error handling path. > > Fixes: 046326989a18 ("firmware: imx: Save channel name for further use") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Good catch. Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
On Sun, Aug 20, 2023 at 08:26:01AM +0200, Christophe JAILLET wrote: > Le 17/01/2023 à 08:55, Daniel Baluta a écrit : > > On Sun, Jan 15, 2023 at 8:35 PM Christophe JAILLET > > <christophe.jaillet@wanadoo.fr> wrote: > > > > > > If mbox_request_channel_byname() fails, the memory allocated a few lines > > > above still need to be freed before going to the error handling path. > > > > > > Fixes: 046326989a18 ("firmware: imx: Save channel name for further use") > > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > > > > Good catch. > > > > Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> > > > > Hi, > > polite reminder. > > This patch is still not in -next. Sorry, not sure how this fell from the crack. Applied, thanks!
diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c index a6c06d7476c3..1f410809d3ee 100644 --- a/drivers/firmware/imx/imx-dsp.c +++ b/drivers/firmware/imx/imx-dsp.c @@ -115,6 +115,7 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) dsp_chan->idx = i % 2; dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); if (IS_ERR(dsp_chan->ch)) { + kfree(dsp_chan->name); ret = PTR_ERR(dsp_chan->ch); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to request mbox chan %s ret %d\n",