Author: hbelusca
Date: Sun Mar 29 15:49:03 2015
New Revision: 66965
URL:
http://svn.reactos.org/svn/reactos?rev=66965&view=rev
Log:
[ACPI:BUS]: Fix dereferencing NULL pointers in acpi_bus_notify. By Victor Martinez with
small adaptation by me.
CORE-8271
Modified:
trunk/reactos/drivers/bus/acpi/busmgr/bus.c
Modified: trunk/reactos/drivers/bus/acpi/busmgr/bus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/busmgr/bu…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/busmgr/bus.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/busmgr/bus.c [iso-8859-1] Sun Mar 29 15:49:03 2015
@@ -721,11 +721,13 @@
//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 @@
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 @@
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 @@
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);
- break;
- }
-
- acpi_bus_get_device(handle, &device);
+ DPRINT1("Received unknown/unsupported notification [%08x] for device
[%s]\n",
+ type, device ? device->pnp.bus_id : "n/a");
+ break;
+ }
+
if (device) {
driver = device->driver;
if (driver && driver->ops.notify &&
@@ -1672,7 +1673,7 @@
/*
* 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 @@
/* 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 @@
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);