* [PATCH] platform/chrome: wilco_ec: Fix device reference leak on open failure
@ 2026-11-05 4:47 Yige Jiang
2026-11-05 5:27 ` Tzung-Bi Shih
0 siblings, 1 reply; 2+ messages in thread
From: Yige Jiang @ 2026-11-05 4:47 UTC (permalink / raw)
To: chrome-platform
Cc: Yige Jiang, Benson Leung, Tzung-Bi Shih, linux-kernel, Nick Crews
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/chrome: wilco_ec: Fix device reference leak on open failure
2026-11-05 4:47 [PATCH] platform/chrome: wilco_ec: Fix device reference leak on open failure Yige Jiang
@ 2026-11-05 5:27 ` Tzung-Bi Shih
0 siblings, 0 replies; 2+ messages in thread
From: Tzung-Bi Shih @ 2026-11-05 5:27 UTC (permalink / raw)
To: Yige Jiang; +Cc: chrome-platform, Benson Leung, linux-kernel, Nick Crews
On Thu, Nov 05, 2026 at 12:47:12PM +0800, Yige Jiang wrote:
> 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
Moving get_device() after kzalloc_obj() succeeds makes it cleaner.
> Assisted-by: LLM
The tag is no longer used; ./scripts/checkpatch.pl --strict:
WARNING: Non-standard signature: Assisted-by:
ERROR: Unrecognized email address: 'LLM'
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 5:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 4:47 [PATCH] platform/chrome: wilco_ec: Fix device reference leak on open failure Yige Jiang
2026-11-05 5:27 ` Tzung-Bi Shih
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®