Message ID | 20221114110854.554220-1-weiyongjun@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2085263wru; Mon, 14 Nov 2022 03:12:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Vz83WELoWbKNGRKURSGHTDE5n5OcbeOfpFzUhwNXgNEoBBD2jI6VaaGgn3493JKpEUZe/ X-Received: by 2002:a17:902:f68c:b0:186:9369:bcec with SMTP id l12-20020a170902f68c00b001869369bcecmr12996031plg.131.1668424347560; Mon, 14 Nov 2022 03:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668424347; cv=none; d=google.com; s=arc-20160816; b=M/I63NE7KPDRGN0XrKewNjuMOt5TZv5Z2SqUtpgaEhKRnoHqrxGnbO/OmCEl6mrhjU O2hnR/3Hxgc2XRMQmop8U++HxWMKAUj3OQsREnsoa3GSJW/seRtziecr5wWrMcUzP8kj XIiT4+vO8dPXlmpSthTLf/UuOZ/Na4OjTwcEL7GF8Kn0/QUaA5Z5KjQgauEWPkJztqPj r6PUuDMx0fEooU9pwuvEZ4zVFOq7Zow9owPS/ScUpYGsPGFdkeNBWXlTNBeASIWObIuB UHzueXNN1qEmKc5rtTTwF+xXND7NEUZxEP3BznGYJ4//+3QnjaVc1EEkQNCKRvyUKZ4M KgEQ== 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=bMuCCJRIsO8XbW2h5aOxGZ319LYZgX51WSf6Lxzzn0g=; b=v7SCYPOOFhgEIy7pXxYAjYGfmKNB145I9ktqersUxH4J9V+ptnTOVhqAo46L1j1x48 5sYzRClZGKzhGzt/Irev/UC8ORLExjO/3rpmzfdqf/UoZW3Tj72KOhO3thA12LbikU78 YfYikD+xRAhhto8t+sM1TDxeKxMPZaJnCwDtThu/raOrOVBbH7Q5pfIAuI3wtof5thH1 6g5ZOXvPN2OoqU6FblDUmHr5Sp5SUjd56DFjyGWO/5j6M7rf7zcrE0QRGHjn7Vaitbnw qpcxtSNuonmNXcc/SFQN3ENMQnavBVzrYcLwluZCTgd0kR73uybnwcNwA8EUVpC6YSnn S2tQ== 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 y131-20020a626489000000b00558991a667esi8823742pfb.359.2022.11.14.03.12.13; Mon, 14 Nov 2022 03:12:27 -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 S235468AbiKNLLJ (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 14 Nov 2022 06:11:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236748AbiKNLKq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 06:10:46 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C27AC22BF8 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 03:08:21 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4N9mkm05LVz4f3m6n for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 19:08:16 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.102.38]) by APP4 (Coremail) with SMTP id gCh0CgAnmdaiIXJjjUwLAg--.26174S4; Mon, 14 Nov 2022 19:08:19 +0800 (CST) From: Wei Yongjun <weiyongjun@huaweicloud.com> To: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= <j.neuschaefer@gmx.net>, Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <maz@kernel.org> Cc: Wei Yongjun <weiyongjun1@huawei.com>, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] irqchip/wpcm450: fix memory leak in ap_init_qci_info() Date: Mon, 14 Nov 2022 11:08:54 +0000 Message-Id: <20221114110854.554220-1-weiyongjun@huaweicloud.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAnmdaiIXJjjUwLAg--.26174S4 X-Coremail-Antispam: 1UD129KBjvdXoW7Gw4fXw4kAFy5Ar4ftryxXwb_yoW3tFb_u3 yUWr9xXFs2kFWrJ347uF45X34qyF1kWrnYg3WIyry5ZFW2qws3Grn7Z3s8tF47WF4xtrn3 Cr97ZFyxZryxGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUboxYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwV A0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x02 67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Y z7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zV AF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4l IxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVW8JVW3Jw CI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnI WIevJa73UjIFyTuYvjxUrku4UUUUU X-CM-SenderInfo: 5zhl50pqjm3046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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?1749469728498907695?= X-GMAIL-MSGID: =?utf-8?q?1749469728498907695?= |
Series |
irqchip/wpcm450: fix memory leak in ap_init_qci_info()
|
|
Commit Message
Wei Yongjun
Nov. 14, 2022, 11:08 a.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com> If of_iomap() failed, 'aic' should be freed before return. Otherwise there is a memory leak. Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> --- drivers/irqchip/irq-wpcm450-aic.c | 1 + 1 file changed, 1 insertion(+)
Comments
Hi, the function name is wrong in the in the subject line. Other than that, the patch looks good. Thanks, Jonathan On Mon, Nov 14, 2022 at 11:08:54AM +0000, Wei Yongjun wrote: > From: Wei Yongjun <weiyongjun1@huawei.com> > > If of_iomap() failed, 'aic' should be freed before return. Otherwise > there is a memory leak. > > Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller") > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> > --- > drivers/irqchip/irq-wpcm450-aic.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c > index 0dcbeb1a05a1..91df62a64cd9 100644 > --- a/drivers/irqchip/irq-wpcm450-aic.c > +++ b/drivers/irqchip/irq-wpcm450-aic.c > @@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node, > aic->regs = of_iomap(node, 0); > if (!aic->regs) { > pr_err("Failed to map WPCM450 AIC registers\n"); > + kfree(aic); > return -ENOMEM; > } > > -- > 2.34.1 >
On 2022/11/15 16:36, Jonathan Neuschäfer wrote: > Hi, > > the function name is wrong in the in the subject line. Other than that, > the patch looks good. Thanks, will fix in next version. Regards, Wei Yongjun > > Thanks, > Jonathan > > > On Mon, Nov 14, 2022 at 11:08:54AM +0000, Wei Yongjun wrote: >> From: Wei Yongjun <weiyongjun1@huawei.com> >> >> If of_iomap() failed, 'aic' should be freed before return. Otherwise >> there is a memory leak. >> >> Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller") >> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> >> --- >> drivers/irqchip/irq-wpcm450-aic.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c >> index 0dcbeb1a05a1..91df62a64cd9 100644 >> --- a/drivers/irqchip/irq-wpcm450-aic.c >> +++ b/drivers/irqchip/irq-wpcm450-aic.c >> @@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node, >> aic->regs = of_iomap(node, 0); >> if (!aic->regs) { >> pr_err("Failed to map WPCM450 AIC registers\n"); >> + kfree(aic); >> return -ENOMEM; >> } >> >> -- >> 2.34.1 >>
diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c index 0dcbeb1a05a1..91df62a64cd9 100644 --- a/drivers/irqchip/irq-wpcm450-aic.c +++ b/drivers/irqchip/irq-wpcm450-aic.c @@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node, aic->regs = of_iomap(node, 0); if (!aic->regs) { pr_err("Failed to map WPCM450 AIC registers\n"); + kfree(aic); return -ENOMEM; }