Skip to content

Commit 95e8d65

Browse files
Dan Carpentergregkh
authored andcommitted
misc: pci_endpoint_test: Avoid triggering a BUG()
[ Upstream commit 846df24 ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 85d63b7 commit 95e8d65

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
@@ -590,6 +590,8 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
590590

591591
if (sscanf(misc_device->name, DRV_MODULE_NAME ".%d", &id) != 1)
592592
return;
593+
if (id < 0)
594+
return;
593595

594596
misc_deregister(&test->miscdev);
595597
ida_simple_remove(&pci_endpoint_test_ida, id);

0 commit comments

Comments
 (0)