acpi: fix single linked list manipulation
PATCH 2/19 acpi: fix single linked list manipulation
From: Akinobu Mita <[email protected]>
Fix single linked list manipulation for sub_driver. If the remving entry is not on the head of the sub_driver list, it goes into infinate loop.
Though that infinite loop doesn't happen. Because the only user of acpi_pci_register_dirver() is acpiphp.
---
drivers/acpi/pci_root.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/acpi/pci_root.c renamed from drivers/acpi/pci_root.c~acpi-fix-single-linked-list-manipulation +5 -4
@@ -98,11 +98,12 @@ void acpi_pci_unregister_driver(struct astruct acpi_pci_driver **pptr = &sub_driver;while (*pptr) { -if (*pptr != driver) -continue ; - *pptr = (*pptr)->next; -break ; +if (*pptr == driver) +break ; + pptr = &(*pptr)->next; } +BUG_ON (!*pptr); + *pptr = (*pptr)->next;if (!driver->remove)return ;
_
Applied.
thanks,
-Len
Quoted 38 lines · On Tuesday 19 December 2006 15:56, [email protected] wrote:
From: Akinobu Mita <[email protected]>
Fix single linked list manipulation for
sub_driver. If the remving entry is not on the head of thesub_driverlist, it goes into infinate loop.Though that infinite loop doesn't happen. Because the only user of
acpi_pci_register_dirver()is acpiphp.Cc Len Brown <[email protected]>Signed-off-by Akinobu Mita <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/acpi/pci_root.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)diff -puN
drivers/acpi/pci_root.c~acpi-fix-single-linked-list-manipulationdrivers/acpi/pci_root.cdrivers/acpi/pci_root.c renamed from drivers/acpi/pci_root.c~acpi-fix-single-linked-list-manipulation +5
-4@@ -98,11 +98,12 @@ void acpi_pci_unregister_driver(struct astruct acpi_pci_driver **pptr = &sub_driver;while (*pptr) { -if (*pptr != driver) -continue ; - *pptr = (*pptr)->next; -break ; +if (*pptr == driver) +break ; + pptr = &(*pptr)->next; } +BUG_ON (!*pptr); + *pptr = (*pptr)->next;if (!driver->remove)return ;_