Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60bacf25 authored by Jamie Iles's avatar Jamie Iles Committed by Greg Kroah-Hartman
Browse files

i2c: acpi: fix resource leak in reconfiguration device addition



[ Upstream commit 6558b646ce1c2a872fe1c2c7cb116f05a2c1950f ]

acpi_i2c_find_adapter_by_handle() calls bus_find_device() which takes a
reference on the adapter which is never released which will result in a
reference count leak and render the adapter unremovable.  Make sure to
put the adapter after creating the client in the same manner that we do
for OF.

Fixes: 525e6fab ("i2c / ACPI: add support for ACPI reconfigure notifications")
Signed-off-by: default avatarJamie Iles <quic_jiles@quicinc.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
[wsa: fixed title]
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b723b34a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -436,6 +436,7 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
			break;
			break;


		i2c_acpi_register_device(adapter, adev, &info);
		i2c_acpi_register_device(adapter, adev, &info);
		put_device(&adapter->dev);
		break;
		break;
	case ACPI_RECONFIG_DEVICE_REMOVE:
	case ACPI_RECONFIG_DEVICE_REMOVE:
		if (!acpi_device_enumerated(adev))
		if (!acpi_device_enumerated(adev))