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>] [day] [month] [year] [list]
Date:   Sat, 23 Jul 2022 14:43:39 +0800
From:   williamsukatube@....com
To:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     kishon@...com, lpieralisi@...nel.org, kw@...ux.com,
        bhelgaas@...gle.com, William Dean <williamsukatube@...il.com>,
        Hacash Robot <hacashRobot@...tino.com>
Subject: [PATCH] PCI: endpoint: check the return value of alloc_workqueue()

From: William Dean <williamsukatube@...il.com>

The function alloc_workqueue() in epf_ntb_init() can
fail, but there is no check of its return value. To fix this bug, its
return value should be checked with new error handling code.

Fixes: 8b821cf761503 ("PCI: endpoint: Add EP function driver to provide NTB functionality")
Reported-by: Hacash Robot <hacashRobot@...tino.com>
Signed-off-by: William Dean <williamsukatube@...il.com>
---
 drivers/pci/endpoint/functions/pci-epf-ntb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/endpoint/functions/pci-epf-ntb.c b/drivers/pci/endpoint/functions/pci-epf-ntb.c
index 9a00448c7e61..41d85591cd1e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-ntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-ntb.c
@@ -2124,6 +2124,11 @@ static int __init epf_ntb_init(void)
 
 	kpcintb_workqueue = alloc_workqueue("kpcintb", WQ_MEM_RECLAIM |
 					    WQ_HIGHPRI, 0);
+	if (!kpcintb_workqueue) {
+		pr_err("Failed to alloc kpcintb workqueue\n");
+		return -ENOMEM;
+	}
+
 	ret = pci_epf_register_driver(&epf_ntb_driver);
 	if (ret) {
 		destroy_workqueue(kpcintb_workqueue);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ