From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, Kishon Vijay Abraham I <kishon@ti.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
Niklas Cassel <niklas.cassel@axis.com>,
Jia-Ju Bai <baijiaju1990@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pci: endpoint: fix a potential NULL pointer dereference
Date: Fri, 12 Apr 2019 15:41:25 +0100 [thread overview]
Message-ID: <20190412144124.GA8730@red-moon> (raw)
In-Reply-To: <20190315050711.8652-1-kjlu@umn.edu>
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
prev parent reply other threads:[~2019-04-12 14:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 5:07 [PATCH] pci: endpoint: fix a potential NULL pointer dereference Kangjie Lu
2019-04-12 14:41 ` Lorenzo Pieralisi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412144124.GA8730@red-moon \
--to=lorenzo.pieralisi@arm.com \
--cc=baijiaju1990@gmail.com \
--cc=bhelgaas@google.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=kishon@ti.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=niklas.cassel@axis.com \
--cc=pakki001@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.