summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-09-30 11:16:51 +0300
committerBjorn Helgaas <bhelgaas@google.com>2017-10-31 15:33:39 -0500
commita2db2663bd72053ca1e4b4f36dfd31ba233c3a65 (patch)
tree369999c8503fa875edfb12db66f23a9a42147944 /drivers/misc
parent343dc693f7b79885197f9d37dd8b711b0e3ffc8f (diff)
downloadop-kernel-dev-a2db2663bd72053ca1e4b4f36dfd31ba233c3a65.zip
op-kernel-dev-a2db2663bd72053ca1e4b4f36dfd31ba233c3a65.tar.gz
misc: pci_endpoint_test: Avoid triggering a BUG()
If you call ida_simple_remove(&pci_endpoint_test_ida, id) with a negative "id" then it triggers an immediate BUG_ON(). Let's not allow that. Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/pci_endpoint_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index c0d3230..d40a34f 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -597,6 +597,8 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
if (sscanf(misc_device->name, DRV_MODULE_NAME ".%d", &id) != 1)
return;
+ if (id < 0)
+ return;
misc_deregister(&test->miscdev);
ida_simple_remove(&pci_endpoint_test_ida, id);
OpenPOWER on IntegriCloud