linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: ACPI / hotplug / PCI: Rework the handling of eject requests
@ 2014-07-08 13:37 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-07-08 13:37 UTC (permalink / raw)
  To: rafael.j.wysocki; +Cc: linux-acpi

Hello Rafael J. Wysocki,

The patch dd2151be28b9: "ACPI / hotplug / PCI: Rework the handling of
eject requests" from Feb 4, 2014, leads to the following static
checker warning:

	drivers/acpi/scan.c:479 acpi_generic_hotplug_event()
	error: we previously assumed 'adev->handler' could be null (see line 473)

drivers/acpi/scan.c
   464  static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
   465  {
   466          switch (type) {
   467          case ACPI_NOTIFY_BUS_CHECK:
   468                  return acpi_scan_bus_check(adev);
   469          case ACPI_NOTIFY_DEVICE_CHECK:
   470                  return acpi_scan_device_check(adev);
   471          case ACPI_NOTIFY_EJECT_REQUEST:
   472          case ACPI_OST_EC_OSPM_EJECT:
   473                  if (adev->handler && !adev->handler->hotplug.enabled) {
                            ^^^^^^^^^^^^^
Patch adds new check.

   474                          dev_info(&adev->dev, "Eject disabled\n");
   475                          return -EPERM;
   476                  }
   477                  acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
   478                                    ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
   479                  return acpi_scan_hot_remove(adev);

"adev->handler" is dereferenced without checking inside the call to
acpi_scan_hot_remove().

   480          }
   481          return -EINVAL;
   482  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-08 13:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 13:37 ACPI / hotplug / PCI: Rework the handling of eject requests Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).