]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ACPI: scan: Use unique number for instance_no
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 22 Mar 2021 16:31:00 +0000 (18:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:30:29 +0000 (14:30 +0200)
commit321dbe6c0b551f9f8030becc6900f77cf9bbb9ad
tree964d1ce55e99f1b78a5380b63a5bb8036fd82d8e
parentc299cb4b9d8564fa62b9dd912b3bd02809aa6915
ACPI: scan: Use unique number for instance_no

[ Upstream commit eb50aaf960e3bedfef79063411ffd670da94b84b ]

The decrementation of acpi_device_bus_id->instance_no
in acpi_device_del() is incorrect, because it may cause
a duplicate instance number to be allocated next time
a device with the same acpi_device_bus_id is added.

Replace above mentioned approach by using IDA framework.

While at it, define the instance range to be [0, 4096).

Fixes: e49bd2dd5a50 ("ACPI: use PNPID:instance_no as bus_id of ACPI device")
Fixes: ca9dc8d42b30 ("ACPI / scan: Fix acpi_bus_id_list bookkeeping")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/internal.h
drivers/acpi/scan.c
include/acpi/acpi_bus.h