Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2217069rwb; Sun, 15 Jan 2023 11:08:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXsueeznub9EhIVeKsvPFAAzPrk7orSPp93r+tyr17j3CJ4t6FPRABPirot5Rkja5XoCoZLm X-Received: by 2002:a17:907:3f08:b0:86a:833d:e7d8 with SMTP id hq8-20020a1709073f0800b0086a833de7d8mr12616917ejc.17.1673809718352; Sun, 15 Jan 2023 11:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673809718; cv=none; d=google.com; s=arc-20160816; b=Afi5PhlMnKveGGd1iNMUtIuTuaEDynONQ9vz7m8jiq3q2VH8vxzEz6Vpl+sB5ja9vN 1B5JS7/FDs5k43NcMX4x22NhTyyOCrC+Hvd3VQeMssRG4UW0fW1hvO9BUkSJnjUGGgSg LCCBGphx4dvqblsxpCTPTfF72ym2lU8Ueux2470PCL2HMQ2qkw51wE9CfE0rU8B/CVvl QuOELuzjPKRZWceUEwOCAw8edzqZdgeK+4g6DP/Nj+3QneGhrgGWdvHZX/5ndr4w3oNR hKwYlAf9vUlEOcWdNVm0DLc19vaJWjxxJ74aDY28mrLJ6QzhkfgjY9bHDV5oW3TuSVwT 1Gnw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xe6-20020a170907318600b0084cbde35b2fsi29209449ejb.465.2023.01.15.11.08.19; Sun, 15 Jan 2023 11:08:38 -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 + 52 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 ); 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 ; 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 To: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Daniel Baluta , Paul Olaru Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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(+) 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", -- 2.34.1