ACPI / scan: Prevent device add uevents from racing with user space
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 24 Jan 2013 11:49:49 +0000 (12:49 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 24 Jan 2013 11:49:49 +0000 (12:49 +0100)
commitcf860be639d86ed77af179c925085ae0721ae602
tree3acb93b90f48f2bc4838ba80cd66dce60a40825a
parente5656271b0221a53e9f74856385112fdcec0dd60
ACPI / scan: Prevent device add uevents from racing with user space

ACPI core adds sysfs device files after the given devices have been
registered with device_register(), which is not appropriate, because
it may lead to race conditions with user space tools using those
files.

Fix the problem by delaying the KOBJ_ADD uevent for ACPI devices
until after all of the devices' sysfs files have been created.

This also fixes a use-after-free in acpi_device_unregister().

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/internal.h
drivers/acpi/power.c
drivers/acpi/scan.c