mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
[ACPI:BUS]: Fix dereferencing NULL pointers in acpi_bus_notify. By Victor Martinez with small adaptation by me.
CORE-8271 svn path=/trunk/; revision=66965
This commit is contained in:
@@ -721,11 +721,13 @@ acpi_bus_notify (
|
||||
//blocking_notifier_call_chain(&acpi_bus_notify_list,
|
||||
// type, (void *)handle);
|
||||
|
||||
acpi_bus_get_device(handle, &device);
|
||||
|
||||
switch (type) {
|
||||
|
||||
case ACPI_NOTIFY_BUS_CHECK:
|
||||
DPRINT("Received BUS CHECK notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
acpi_bus_check_scope(handle);
|
||||
/*
|
||||
* TBD: We'll need to outsource certain events to non-ACPI
|
||||
@@ -735,7 +737,7 @@ acpi_bus_notify (
|
||||
|
||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||
DPRINT("Received DEVICE CHECK notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
acpi_bus_check_device(handle);
|
||||
/*
|
||||
* TBD: We'll need to outsource certain events to non-ACPI
|
||||
@@ -745,7 +747,7 @@ acpi_bus_notify (
|
||||
|
||||
case ACPI_NOTIFY_DEVICE_WAKE:
|
||||
DPRINT("Received DEVICE WAKE notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
acpi_bus_check_device(handle);
|
||||
/*
|
||||
* TBD: We'll need to outsource certain events to non-ACPI
|
||||
@@ -755,41 +757,40 @@ acpi_bus_notify (
|
||||
|
||||
case ACPI_NOTIFY_EJECT_REQUEST:
|
||||
DPRINT1("Received EJECT REQUEST notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
/* TBD */
|
||||
break;
|
||||
|
||||
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
|
||||
DPRINT1("Received DEVICE CHECK LIGHT notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
/* TBD: Exactly what does 'light' mean? */
|
||||
break;
|
||||
|
||||
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
|
||||
DPRINT1("Received FREQUENCY MISMATCH notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
/* TBD */
|
||||
break;
|
||||
|
||||
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
|
||||
DPRINT1("Received BUS MODE MISMATCH notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
/* TBD */
|
||||
break;
|
||||
|
||||
case ACPI_NOTIFY_POWER_FAULT:
|
||||
DPRINT1("Received POWER FAULT notification for device [%s]\n",
|
||||
device->pnp.bus_id);
|
||||
device ? device->pnp.bus_id : "n/a");
|
||||
/* TBD */
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("Received unknown/unsupported notification [%08x]\n",
|
||||
type);
|
||||
DPRINT1("Received unknown/unsupported notification [%08x] for device [%s]\n",
|
||||
type, device ? device->pnp.bus_id : "n/a");
|
||||
break;
|
||||
}
|
||||
|
||||
acpi_bus_get_device(handle, &device);
|
||||
if (device) {
|
||||
driver = device->driver;
|
||||
if (driver && driver->ops.notify &&
|
||||
@@ -1672,7 +1673,7 @@ acpi_bus_init (void)
|
||||
/*
|
||||
* Register the for all standard device notifications.
|
||||
*/
|
||||
status = AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
|
||||
status = AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, acpi_bus_notify, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DPRINT1("Unable to register for device notifications\n");
|
||||
result = AE_NOT_FOUND;
|
||||
@@ -1703,7 +1704,7 @@ acpi_bus_init (void)
|
||||
/* Mimic structured exception handling */
|
||||
error2:
|
||||
AcpiRemoveNotifyHandler(ACPI_ROOT_OBJECT,
|
||||
ACPI_SYSTEM_NOTIFY, &acpi_bus_notify);
|
||||
ACPI_SYSTEM_NOTIFY, acpi_bus_notify);
|
||||
error1:
|
||||
AcpiTerminate();
|
||||
return_VALUE(AE_NOT_FOUND);
|
||||
@@ -1752,7 +1753,7 @@ acpi_init (void)
|
||||
|
||||
DPRINT("Subsystem revision %08x\n",ACPI_CA_VERSION);
|
||||
|
||||
KeInitializeSpinLock(&acpi_bus_event_lock);
|
||||
KeInitializeSpinLock(&acpi_bus_event_lock);
|
||||
KeInitializeEvent(&AcpiEventQueue, NotificationEvent, FALSE);
|
||||
ExInitializeFastMutex(&acpi_bus_drivers_lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user