From: Yige Jiang <yigejiang86@gmail.com>
To: chrome-platform@lists.linux.dev
Cc: Yige Jiang <yigejiang86@gmail.com>,
Benson Leung <bleung@chromium.org>,
Tzung-Bi Shih <tzungbi@kernel.org>,
linux-kernel@vger.kernel.org, Nick Crews <ncrews@chromium.org>
Subject: [PATCH] platform/chrome: wilco_ec: Fix device reference leak on open failure
Date: Thu, 5 Nov 2026 12:47:12 +0800 [thread overview]
Message-ID: <rc-review-20261103-vc-85-d1e3d35e7c31@gmail.com> (raw)
telem_open() takes a reference to dev_data->dev before allocating
the session. If that allocation fails, it returns -ENOMEM without
dropping the reference. Since release is not called after a failed
open, the device data remains pinned after removal.
Drop the reference on the allocation failure path, after restoring
the available flag. Keeping the put after that final access avoids
touching dev_data if the put invokes telem_device_free().
Fixes: 1210d1e6bad1 ("platform/chrome: wilco_ec: Add telemetry char device interface")
Assisted-by: LLM
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
COMPILE_TEST=y.
Baseline and patched target objects built from this exact base.
No full kernel/module-link, hardware or runtime test was performed.
AI assistance: Codex (LLM) for ownership analysis, code and changelog.
drivers/platform/chrome/wilco_ec/telemetry.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c
index 45be318b05f6..79fcc46e4417 100644
--- a/drivers/platform/chrome/wilco_ec/telemetry.c
+++ b/drivers/platform/chrome/wilco_ec/telemetry.c
@@ -250,6 +250,7 @@ static int telem_open(struct inode *inode, struct file *filp)
sess_data = kzalloc_obj(*sess_data);
if (!sess_data) {
atomic_set(&dev_data->available, 1);
+ put_device(&dev_data->dev);
return -ENOMEM;
}
sess_data->dev_data = dev_data;
base-commit: 2637bdec0535a2044cd830eba9a79363651d9043
next reply other threads:[~2026-11-05 4:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 4:47 Yige Jiang [this message]
2026-11-05 5:27 ` Tzung-Bi Shih
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=rc-review-20261103-vc-85-d1e3d35e7c31@gmail.com \
--to=yigejiang86@gmail.com \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=ncrews@chromium.org \
--cc=tzungbi@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
all inboxes | Powered by JetHome®