From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jussi Kivilinna <jussi.kivilinna@haltian.com>,
Colin Ian King <colin.king@canonical.com>,
Tim Harvey <tharvey@gateworks.com>,
Raz Manor <Raz.Manor@valens.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Alan Stern <stern@rowland.harvard.edu>,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>,
Peter Senna Tschudin <peter.senna@gmail.com>
Subject: [PATCH v2] usb: gadget: udc: add null check before pointer dereference
Date: Tue, 2 May 2017 11:37:22 -0500 [thread overview]
Message-ID: <20170502163722.GA27331@embeddedgus> (raw)
In-Reply-To: <20170502102901.Horde.V3lYucW4z0pbiibIoA4m_9v@gator4166.hostgator.com>
Add null check before dereferencing dev->regs pointer inside
net2280_led_shutdown() function.
Addresses-Coverity-ID: 101783
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
Changes in v2:
Move the net2280_led_shutdown() call later.
drivers/usb/gadget/udc/net2280.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 3828c2e..4f5c0c4 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -3573,7 +3573,6 @@ static void net2280_remove(struct pci_dev *pdev)
BUG_ON(dev->driver);
/* then clean up the resources we allocated during probe() */
- net2280_led_shutdown(dev);
if (dev->requests) {
int i;
for (i = 1; i < 5; i++) {
@@ -3588,8 +3587,10 @@ static void net2280_remove(struct pci_dev *pdev)
free_irq(pdev->irq, dev);
if (dev->quirks & PLX_PCIE)
pci_disable_msi(pdev);
- if (dev->regs)
+ if (dev->regs) {
+ net2280_led_shutdown(dev);
iounmap(dev->regs);
+ }
if (dev->region)
release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
--
2.5.0
next prev parent reply other threads:[~2017-05-02 17:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 3:38 [PATCH] usb: gadget: udc: add null check before pointer dereference Gustavo A. R. Silva
2017-05-02 14:31 ` Alan Stern
2017-05-02 15:29 ` Gustavo A. R. Silva
2017-05-02 16:37 ` Gustavo A. R. Silva [this message]
2017-05-02 18:45 ` [PATCH v2] " Alan Stern
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=20170502163722.GA27331@embeddedgus \
--to=garsilva@embeddedor.com \
--cc=Raz.Manor@valens.com \
--cc=balbi@kernel.org \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=jussi.kivilinna@haltian.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.senna@gmail.com \
--cc=stern@rowland.harvard.edu \
--cc=tharvey@gateworks.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox