Skip to content

Commit 846df24

Browse files
Dan Carpentergregkh
authored andcommitted
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: 2c156ac ("misc: Add host side PCI driver for PCI test function device") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 378f79c commit 846df24

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/misc/pci_endpoint_test.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
597597

598598
if (sscanf(misc_device->name, DRV_MODULE_NAME ".%d", &id) != 1)
599599
return;
600+
if (id < 0)
601+
return;
600602

601603
misc_deregister(&test->miscdev);
602604
ida_simple_remove(&pci_endpoint_test_ida, id);

0 commit comments

Comments
 (0)