* [PATCH] pci: endpoint: fix a potential NULL pointer dereference
@ 2019-03-15 5:07 Kangjie Lu
2019-04-12 14:41 ` Lorenzo Pieralisi
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-15 5:07 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Kishon Vijay Abraham I, Lorenzo Pieralisi,
Bjorn Helgaas, Gustavo Pimentel, Niklas Cassel, Jia-Ju Bai,
linux-pci, linux-kernel
In case alloc_workqueue, the fix returns -ENOMEM to avoid
potential NULL pointer dereferences.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 3e86fa3c7da3..dc610eb1543a 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -570,6 +570,10 @@ static int __init pci_epf_test_init(void)
kpcitest_workqueue = alloc_workqueue("kpcitest",
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
+ if (unlikely(!kpcitest_workqueue)) {
+ pr_err("Failed to allocate the kpcitest work queue\n");
+ return -ENOMEM;
+ }
ret = pci_epf_register_driver(&test_driver);
if (ret) {
pr_err("Failed to register pci epf test driver --> %d\n", ret);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pci: endpoint: fix a potential NULL pointer dereference
2019-03-15 5:07 [PATCH] pci: endpoint: fix a potential NULL pointer dereference Kangjie Lu
@ 2019-04-12 14:41 ` Lorenzo Pieralisi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2019-04-12 14:41 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Kishon Vijay Abraham I, Bjorn Helgaas,
Gustavo Pimentel, Niklas Cassel, Jia-Ju Bai, linux-pci,
linux-kernel
On Fri, Mar 15, 2019 at 12:07:10AM -0500, Kangjie Lu wrote:
> In case alloc_workqueue, the fix returns -ENOMEM to avoid
> potential NULL pointer dereferences.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 3e86fa3c7da3..dc610eb1543a 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -570,6 +570,10 @@ static int __init pci_epf_test_init(void)
>
> kpcitest_workqueue = alloc_workqueue("kpcitest",
> WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
> + if (unlikely(!kpcitest_workqueue)) {
> + pr_err("Failed to allocate the kpcitest work queue\n");
> + return -ENOMEM;
> + }
> ret = pci_epf_register_driver(&test_driver);
> if (ret) {
> pr_err("Failed to register pci epf test driver --> %d\n", ret);
Updated the code slighty and pushed out to pci/misc, thanks.
Lorenzo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-12 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 5:07 [PATCH] pci: endpoint: fix a potential NULL pointer dereference Kangjie Lu
2019-04-12 14:41 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).