lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_3F6931DF7E765EB870FD970A@qq.com>
Date: Sat, 31 Aug 2024 15:30:10 +0800
From: "Wentao Guan" <guanwentao@...ontech.com>
To: "Huacai Chen" <chenhuacai@...nel.org>
Cc: "WANG Xuerui" <kernel@...0n.name>, "loongarch" <loongarch@...ts.linux.dev>, "linux-kernel" <linux-kernel@...r.kernel.org>, "王昱力" <wangyuli@...ontech.com>
Subject: Re: [PATCH] Loongarch64: pci: fix memleak in pci_acpi_scan_root

Hello Huacai:

Okay... It is my code smell, here is the patch after change.

From 73426019a83a77b4502491fc96d145e666b16936 Mon Sep 17 00:00:00 2001
From: Wentao Guan <guanwentao@...ontech.com>
Date: Sat, 31 Aug 2024 00:17:10 +0800
Subject: [PATCH] Loongarch64: pci: fix memleak in pci_acpi_scan_root

Add kfree(root_ops) in this case to avoid memleak root_ops,
leaks when pci_find_bus() != 0.

Signed-off-by: Wangyuli <wangyuli@...ontech.com>
Signed-off-by: Wentao Guan <guanwentao@...ontech.com>
---
 arch/loongarch/pci/acpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c
index 3eb61b8cd5e3..f405409a3491 100644
--- a/arch/loongarch/pci/acpi.c
+++ b/arch/loongarch/pci/acpi.c
@@ -227,6 +227,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
        if (bus) {
                memcpy(bus->sysdata, info->cfg, sizeof(struct pci_config_window));
                kfree(info);
+               kfree(root_ops);
        } else {
                struct pci_bus *child;
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ