]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
PCI: endpoint: Add missing NULL check for alloc_workqueue()
authorHaotian Zhang <vulab@iscas.ac.cn>
Mon, 10 Nov 2025 04:04:46 +0000 (12:04 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 29 Dec 2025 16:36:37 +0000 (10:36 -0600)
commit03f336a869b3a3f119d3ae52ac9723739c7fb7b6
tree06c81db004b40656b0d705316062cc2a577070d3
parent0d325cbdc5ce97e6bd391d6a742607814025e69d
PCI: endpoint: Add missing NULL check for alloc_workqueue()

alloc_workqueue() can return NULL on memory allocation failure. Without
proper error checking, this may lead to a NULL pointer dereference when
queue_work() is later called with the NULL workqueue pointer in
epf_ntb_epc_init().

Add a NULL check immediately after alloc_workqueue() and return -ENOMEM on
failure to prevent the driver from loading with an invalid workqueue
pointer.

Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
Fixes: 8b821cf76150 ("PCI: endpoint: Add EP function driver to provide NTB functionality")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20251110040446.2065-1-vulab@iscas.ac.cn
drivers/pci/endpoint/functions/pci-epf-ntb.c
drivers/pci/endpoint/functions/pci-epf-vntb.c