From: Jamie Iles <quic_jiles@quicinc.com>
To: <linux-i2c@vger.kernel.org>
Cc: Jamie Iles <quic_jiles@quicinc.com>,
Octavian Purdila <octavian.purdila@intel.com>,
Wolfram Sang <wsa@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH] i2c / ACPI: fix resource leak in reconfiguration device addition
Date: Wed, 22 Sep 2021 17:57:18 +0100 [thread overview]
Message-ID: <20210922165718.179585-1-quic_jiles@quicinc.com> (raw)
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: 525e6fabeae2 ("i2c / ACPI: add support for ACPI reconfigure notifications")
Cc: Octavian Purdila <octavian.purdila@intel.com>
Cc: Wolfram Sang <wsa@kernel.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
---
drivers/i2c/i2c-core-acpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 6f0aa0ed3241..74925621f239 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -422,6 +422,7 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
break;
i2c_acpi_register_device(adapter, adev, &info);
+ put_device(&adapter->dev);
break;
case ACPI_RECONFIG_DEVICE_REMOVE:
if (!acpi_device_enumerated(adev))
--
2.30.2
next reply other threads:[~2021-09-22 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 16:57 Jamie Iles [this message]
2021-09-23 6:51 ` [PATCH] i2c / ACPI: fix resource leak in reconfiguration device addition Mika Westerberg
2021-09-29 20:56 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210922165718.179585-1-quic_jiles@quicinc.com \
--to=quic_jiles@quicinc.com \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=octavian.purdila@intel.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).