diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-24 06:49:49 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-24 06:49:49 -0500 |
commit | cf860be639d86ed77af179c925085ae0721ae602 (patch) | |
tree | 3acb93b90f48f2bc4838ba80cd66dce60a40825a /drivers/acpi/internal.h | |
parent | e5656271b0221a53e9f74856385112fdcec0dd60 (diff) |
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>
Diffstat (limited to 'drivers/acpi/internal.h')
-rw-r--r-- | drivers/acpi/internal.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 1f004f35bc67..c5a61cd6c1a5 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -40,10 +40,11 @@ static inline void acpi_debugfs_init(void) { return; } | |||
40 | #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ | 40 | #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ |
41 | ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) | 41 | ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) |
42 | 42 | ||
43 | int acpi_device_register(struct acpi_device *device, | 43 | int acpi_device_add(struct acpi_device *device, |
44 | void (*release)(struct device *)); | 44 | void (*release)(struct device *)); |
45 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | 45 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, |
46 | int type, unsigned long long sta); | 46 | int type, unsigned long long sta); |
47 | void acpi_device_add_finalize(struct acpi_device *device); | ||
47 | void acpi_free_ids(struct acpi_device *device); | 48 | void acpi_free_ids(struct acpi_device *device); |
48 | 49 | ||
49 | /* -------------------------------------------------------------------------- | 50 | /* -------------------------------------------------------------------------- |