diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-12 00:52:49 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-12 14:55:16 +0100 |
commit | 0f6aa09e40c38d734f5d70762056116ca4a76126 (patch) | |
tree | b6c7d8d5133432e97ba9e42a6d3df94b1b828e4e /drivers/acpi | |
parent | 8fcfb99c8e29c73dd8945b6105ef54ca4eeb171e (diff) | |
download | linux-0f6aa09e40c38d734f5d70762056116ca4a76126.tar.gz linux-0f6aa09e40c38d734f5d70762056116ca4a76126.tar.bz2 linux-0f6aa09e40c38d734f5d70762056116ca4a76126.zip |
ACPI / container: Fix error code path in container_device_attach()
To avoid leaking memory on errors from device_register(), do a
put_device() on the device object in question in the error code
path of container_device_attach().
Fixes: caa73ea158de (ACPI / hotplug / driver core: Handle containers in a special way)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/container.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 0b6ae6eb5c4a..368f9ddb8480 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -79,9 +79,10 @@ static int container_device_attach(struct acpi_device *adev, ACPI_COMPANION_SET(dev, adev); dev->release = acpi_container_release; ret = device_register(dev); - if (ret) + if (ret) { + put_device(dev); return ret; - + } adev->driver_data = dev; return 1; } |