mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
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: 2c156ac71c
("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>
This commit is contained in:
parent
343dc693f7
commit
a2db2663bd
@ -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)
|
if (sscanf(misc_device->name, DRV_MODULE_NAME ".%d", &id) != 1)
|
||||||
return;
|
return;
|
||||||
|
if (id < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
misc_deregister(&test->miscdev);
|
misc_deregister(&test->miscdev);
|
||||||
ida_simple_remove(&pci_endpoint_test_ida, id);
|
ida_simple_remove(&pci_endpoint_test_ida, id);
|
||||||
|
Loading…
Reference in New Issue
Block a user