]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: scan: Make acpi_bus_get_device() clear return pointer on error
authorHans de Goede <hdegoede@redhat.com>
Fri, 15 Jan 2021 21:57:52 +0000 (22:57 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 20 Jan 2021 18:20:20 +0000 (19:20 +0100)
commit25f749e617710f5ca8a0a8b1f3e15582fb145427
treef25963c016fca7c8841887a7aed8eee8bb0c3286
parent9fb686b91f85f6106279ccd602ad0555eb2734b1
ACPI: scan: Make acpi_bus_get_device() clear return pointer on error

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 48f6b710187d ("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: cfb18f79500f ("ACPI: Add _DEP support to fix battery issue on Asus T100TA")
Fixes: 93563282068e ("usb: split code locating ACPI companion into port and device")
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Diagnosed-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: All applicable <stable@vger.kernel.org>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/scan.c