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-next>] [day] [month] [year] [list]
Message-Id: <20220607122831.32738-1-xiaohuizhang@ruc.edu.cn>
Date:   Tue,  7 Jun 2022 20:28:31 +0800
From:   Xiaohui Zhang <xiaohuizhang@....edu.cn>
To:     Xiaohui Zhang <xiaohuizhang@....edu.cn>,
        Shay Agroskin <shayagr@...zon.com>,
        Arthur Kiyanovski <akiyano@...zon.com>,
        David Arinzon <darinzon@...zon.com>,
        Noam Dagan <ndagan@...zon.com>,
        Saeed Bishara <saeedb@...zon.com>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Sameeh Jubran <sameehj@...zon.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] net: ena_netdev: fix resource leak

Similar to the handling of u132_hcd_init in commit f276e002793c
("usb: u132-hcd: fix resource leak"), we thought a patch might be
needed here as well.

If platform_driver_register fails, cleanup the allocated resource
gracefully.

Signed-off-by: Xiaohui Zhang <xiaohuizhang@....edu.cn>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 6a356a6cee15..c0624ee8d867 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -4545,13 +4545,17 @@ static struct pci_driver ena_pci_driver = {
 
 static int __init ena_init(void)
 {
+	int retval;
 	ena_wq = create_singlethread_workqueue(DRV_MODULE_NAME);
 	if (!ena_wq) {
 		pr_err("Failed to create workqueue\n");
 		return -ENOMEM;
 	}
+	retval = pci_register_driver(&ena_pci_driver);
+	if (retval)
+		destroy_workqueue(ena_wq);
 
-	return pci_register_driver(&ena_pci_driver);
+	return retval;
 }
 
 static void __exit ena_cleanup(void)
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ