From: sashiko-bot@kernel.org
To: "Rosalie Wanders" <rosalie@mailbox.org>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2 3/4] HID: sony: remove unneeded which argument from sony_schedule_work()
Date: Tue, 16 Jun 2026 21:04:24 +0000 [thread overview]
Message-ID: <20260616210424.CCCC21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260616205042.6671-5-rosalie@mailbox.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unbalanced `hid_hw_close()` calls lead to `hdev->ll_open_count` underflow.
--
commit 45be0bef88ed1ff7df93b4882f4865bcd24126c9
Author: Rosalie Wanders <rosalie@mailbox.org>
HID: sony: remove unneeded which argument from sony_schedule_work()
The sony_worker enum only had a single member, so removing it simplifies
sony_schedule_work().
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index aa5e65a13ecbc..9014c1db1ba5c 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
[ ... ]
> @@ -1859,7 +1849,7 @@ static int sony_play_effect(struct input_dev *dev, void *data,
> sc->left = effect->u.rumble.strong_magnitude / 256;
> sc->right = effect->u.rumble.weak_magnitude / 256;
>
> - sony_schedule_work(sc, SONY_WORKER_STATE);
> + sony_schedule_work(sc);
> return 0;
> }
[Severity: High]
This is a pre-existing issue, but I noticed a potential problem with
unbalanced hid_hw_close() calls leading to an underflow of the open count
in this driver.
In sony_input_configured(), hid_hw_open() is only called if the device
supports battery reporting. However, both the error path in
sony_input_configured() and sony_remove() unconditionally call
hid_hw_close():
drivers/hid/hid-sony.c:sony_input_configured() {
...
err_close:
hid_hw_close(hdev);
...
}
drivers/hid/hid-sony.c:sony_remove() {
...
hid_hw_close(hdev);
...
}
For devices without battery support (such as motion controllers or
buzz controllers), does this cause an unbalanced close that steals an active
userspace open reference or underflows the open count?
If the force feedback initialization fails for a motion controller over USB,
would the error path execute an unbalanced hid_hw_close() and corrupt the
lifecycle state of the HID device, breaking the low-level driver open and
close state machine?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260616205042.6671-2-rosalie@mailbox.org?part=3
next prev parent reply other threads:[~2026-06-16 21:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 20:50 [PATCH v2 0/4] HID: sony: more cleanup Rosalie Wanders
2026-06-16 20:50 ` [PATCH v2 1/4] HID: sony: use dedicated raw_event() handlers in sony_raw_event() Rosalie Wanders
2026-06-16 21:08 ` sashiko-bot
2026-06-16 20:50 ` [PATCH v2 2/4] HID: sony: use guard() and scoped_guard() Rosalie Wanders
2026-06-16 20:50 ` [PATCH v2 3/4] HID: sony: remove unneeded which argument from sony_schedule_work() Rosalie Wanders
2026-06-16 21:04 ` sashiko-bot [this message]
2026-06-16 20:50 ` [PATCH v2 4/4] HID: sony: use devm_kasprintf() Rosalie Wanders
2026-06-16 20:55 ` [PATCH v2 0/4] HID: sony: more cleanup Jiri Kosina
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=20260616210424.CCCC21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=rosalie@mailbox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox