Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1501565ybj; Tue, 5 May 2020 23:02:23 -0700 (PDT) X-Google-Smtp-Source: APiQypJM0jlqmXRMqvMQX6pK/sBv0HhbAZJSRD9Mxx8N2KraEeaNo6sbxASHXcghAHzdyWp2p9xe X-Received: by 2002:a50:b412:: with SMTP id b18mr5401107edh.42.1588744943252; Tue, 05 May 2020 23:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588744943; cv=none; d=google.com; s=arc-20160816; b=cskqZjTvDFsZeOL/HiG5CVpZree55XkVMLacosz+/YHT/zpjx5re6lryC19Bd58wMq OMd3Z5EYDfrX97Nht/ML3r34JaNrnRs2Ornj2AZu6iTMjV2+T54iqUxpLqUXOTrNEdHe IMbp3Sd5TjyjtLL0H2AAXvey4QCW+pEyJlRnwu4i2XbJLpsCcqWP7NItHBtpmGRdtX5E tg1YjLVwVq4PTq81g3AjtH542Xw0f6tfnYD9qZ7lmosdmorPVcjqyVgW7TxSbzwuBa4s epnhhr2IEkXRjX2PM0P1dYPitqV3rsIWv8bGyiz1Bj7MTC5dyw0Jt15uibLQVVdH/wMq ZFgQ== 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 :message-id:date:subject:cc:to:from; bh=/rsFCuCQ8YCzn1EHy1bIFpkpewju8NXnP4kRMzzvPvA=; b=kzjw6LmZv6oCAtD7R8H4EgVqyg7B7QZuJqi5p3KUm/dvZW4qwl32ZPn5OdvQALiLZv cZC3yIrsvOwyhsk8xes+sRYQi3ci2l6Jrfrz6exPew3+1qmXFtTF9ik3FSQdLac7ShBj n65DH3FRZluSXZNebr5/P+oY9YMVEpKMr+F0NB64j0OoE/rNYjUM97Faif+i7zB9L+fm Job/a2VcwlKe9ffIWZt0OL28n65xW0Qhx57VLvCIr37ROF4Z18jQ3EwWp4ymD6vanGfJ QAtUztoN22VDodo0S7BqvByS5j74zHGp8v2h7CeeuU8iv/eVvsq6l+Vh6ASUQ0I6zNER K+SQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si454849edi.65.2020.05.05.23.01.58; Tue, 05 May 2020 23:02:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbgEFFKR (ORCPT + 99 others); Wed, 6 May 2020 01:10:17 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3852 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725821AbgEFFKR (ORCPT ); Wed, 6 May 2020 01:10:17 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 57FC7CF745FA5A634122; Wed, 6 May 2020 13:10:14 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Wed, 6 May 2020 13:10:04 +0800 From: Wei Yongjun To: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Dong Aisheng CC: Wei Yongjun , , , Subject: [PATCH -next] firmware: imx: scu: Fix possible memory leak in imx_scu_probe() Date: Wed, 6 May 2020 05:14:10 +0000 Message-ID: <20200506051410.27219-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'chan_name' is malloced in imx_scu_probe() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: edbee095fafb ("firmware: imx: add SCU firmware driver support") Signed-off-by: Wei Yongjun --- drivers/firmware/imx/imx-scu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c index b3da2e193ad2..176ddd151375 100644 --- a/drivers/firmware/imx/imx-scu.c +++ b/drivers/firmware/imx/imx-scu.c @@ -314,6 +314,7 @@ static int imx_scu_probe(struct platform_device *pdev) if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to request mbox chan %s ret %d\n", chan_name, ret); + kfree(chan_name); return ret; }