From: sashiko-bot@kernel.org
To: "Doruk Tan Ozturk" <doruk@0sec.ai>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2] HID: uclogic: fix UAF on inrange_timer at teardown and probe error
Date: Sat, 11 Jul 2026 08:37:34 +0000 [thread overview]
Message-ID: <20260711083735.37EAF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260711080350.81108-1-doruk@0sec.ai>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing kfree(drvdata->desc_ptr) in the uclogic_probe error path leads to a memory leak of the dynamically allocated replacement report descriptor.
--
--- Patch [1]: [PATCH v2] HID: uclogic: fix UAF on inrange_timer at teardown and probe error ---
commit 765009419dfdd98b6d556b9c30dc95cac5ee9252
Author: Doruk Tan Ozturk <doruk@0sec.ai>
HID: uclogic: fix UAF on inrange_timer at teardown and probe error
This commit replaces timer_delete_sync() with timer_shutdown_sync() to
prevent use-after-free bugs caused by the timer being re-armed during device
teardown. It also ensures the timer is properly shut down in the probe error
path.
> diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
> --- a/drivers/hid/hid-uclogic-core.c
> +++ b/drivers/hid/hid-uclogic-core.c
> @@ -267,6 +267,13 @@ static int uclogic_probe(struct hid_device *hdev,
> /* Assume "remove" might not be called if "probe" failed */
> if (params_initialized)
> uclogic_params_cleanup(&drvdata->params);
> + /*
> + * If hid_hw_start() started I/O and then failed, raw_event may have
> + * armed the timer; shut it down so it cannot fire on the devm-freed
> + * drvdata after probe returns.
> + */
> + if (drvdata)
> + timer_shutdown_sync(&drvdata->inrange_timer);
[Severity: High]
This isn't a bug introduced by this patch, but does this error path leak
drvdata->desc_ptr?
If uclogic_probe() successfully allocates drvdata->desc_ptr via
uclogic_params_get_desc(), but a subsequent initialization step like
hid_parse() or hid_hw_start() fails, it jumps to the failure label. The
error path cleans up params and shuts down the timer, but it appears to miss
calling kfree(drvdata->desc_ptr) before returning.
> return rc;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711080350.81108-1-doruk@0sec.ai?part=1
prev parent reply other threads:[~2026-07-11 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 7:30 [PATCH] HID: uclogic: fix UAF on inrange_timer at driver unbind Doruk Tan Ozturk
2026-07-11 7:41 ` sashiko-bot
2026-07-11 8:03 ` [PATCH v2] HID: uclogic: fix UAF on inrange_timer at teardown and probe error Doruk Tan Ozturk
2026-07-11 8:37 ` sashiko-bot [this message]
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=20260711083735.37EAF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=doruk@0sec.ai \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.