PCI: hotplug: ACPI: Fix context refcounting in acpiphp_grab_context()
commitae86233204bab50945c1c18b8664ddae00517748
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 26 Jun 2020 17:42:34 +0000 (26 19:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:05:20 +0000 (21 13:05 +0200)
treec2157d59eeef2a0cf05445136928915af6278844
parent72ba9d544e60ac25b89525924f3ec1ebb0791cb7
PCI: hotplug: ACPI: Fix context refcounting in acpiphp_grab_context()

commit dae68d7fd4930315389117e9da35b763f12238f9 upstream.

If context is not NULL in acpiphp_grab_context(), but the
is_going_away flag is set for the device's parent, the reference
counter of the context needs to be decremented before returning
NULL or the context will never be freed, so make that happen.

Fixes: edf5bf34d408 ("ACPI / dock: Use callback pointers from devices' ACPI hotplug contexts")
Reported-by: Vasily Averin <vvs@virtuozzo.com>
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/hotplug/acpiphp_glue.c