Commit 93e2b7e0 authored by Hans de Goede's avatar Hans de Goede Committed by Yang Yingliang
Browse files

ACPI: scan: Make acpi_bus_get_device() clear return pointer on error



stable inclusion
from linux-4.19.171
commit 7efb1858e28b96b4ea0eac7616dc90290de42335

--------------------------------

commit 78a18fec upstream.

Set the acpi_device pointer which acpi_bus_get_device() returns-by-
reference to NULL on errors.

We've recently had 2 cases where callers of acpi_bus_get_device()
did not properly error check the return value, so set the returned-
by-reference acpi_device pointer to NULL, because at least some
callers of acpi_bus_get_device() expect that to be done on errors.

[ rjw: This issue was exposed by commit 71da201f ("ACPI: scan:
  Defer enumeration of devices with _DEP lists") which caused it to
  be much more likely to occur on some systems, but the real defect
  had been introduced by an earlier commit. ]

Fixes: 40e7fcb1 ("ACPI: Add _DEP support to fix battery issue on Asus T100TA")
Fixes: bcfcd409 ("usb: split code locating ACPI companion into port and device")
Reported-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Diagnosed-by: default avatarRafael J. Wysocki <rafael@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Cc: All applicable <stable@vger.kernel.org>
[ rjw: Subject and changelog edits ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
parent 7d351fbf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment