From: sashiko-bot@kernel.org
To: "Vicki Pfau" <vi@endrift.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v7 12/12] Input: xbox_gip - Add wheel support
Date: Sat, 12 Sep 2026 03:33:54 +0000 [thread overview]
Message-ID: <20260912033355.7B0D71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912030426.2997003-13-vi@endrift.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [Medium] Late length checks in input report handlers leave events unsynchronized on truncated packets.
- [Medium] Incorrect modulo arithmetic for relative dial causes erratic reverse jumps.
- [Medium] Static configuration of `max_angle` with 0 precision causes integer underflow, bypassing validation.
Pre-existing issues:
- [High] AB-BA deadlock between LED sysfs operations and device unregistration.
--
commit 533e8fbcd84078cc304b29f07232970fb0a6e7d7
Author: Vicki Pfau <vi@endrift.com>
Input: xbox_gip - Add wheel support
This adds preliminary support for racing wheel support in xbox_gip,
exposing them mapped to the newly added axes.
> diff --git a/drivers/input/joystick/gip/gip-core.c b/drivers/input/joystick/gip/gip-core.c
> index 720b9a075ed3a..42e191f0aef24 100644
> --- a/drivers/input/joystick/gip/gip-core.c
> +++ b/drivers/input/joystick/gip/gip-core.c
[ ... ]
> @@ -334,6 +334,8 @@ static const struct gip_driver *base_drivers[] = {
> &gip_driver_gamepad,
> &gip_driver_arcade_stick,
> &gip_driver_pdp_jaguar,
> + &gip_driver_trueforce_wheel,
> + &gip_driver_wheel,
[Severity: High]
This is a pre-existing issue, but does adding these devices expose them to
the AB-BA deadlock between LED sysfs operations and device unregistration?
During device disconnect, gip_reset_attachment() acquires attachment->lock and
calls gip_free_devices(), which manually calls input_unregister_device(). If
there are no open evdev handles, this synchronously tears down the device and
its devres resources, invoking led_classdev_unregister(). This function blocks
in kernfs_drain waiting for active sysfs operations to complete. Concurrently,
a sysfs write to the LED brightness holds the kernfs active reference and calls
gip_guide_led_set(), which blocks trying to acquire attachment->lock.
> diff --git a/drivers/input/joystick/gip/gip-wheel.c b/drivers/input/joystick/gip/gip-wheel.c
> new file mode 100644
> index 0000000000000..bd281b295eac1
> --- /dev/null
> +++ b/drivers/input/joystick/gip/gip-wheel.c
[ ... ]
> +static int gip_handle_wheel_report(struct gip_attachment *attachment,
> + struct input_dev *input, const uint8_t *bytes, int num_bytes)
> +{
> + uint8_t connections;
> + struct gip_wheel_info *info = attachment->driver_data;
> + int rc = gip_driver_navigation.handle_input_report(attachment, input, bytes, num_bytes);
> +
> + if (rc < 0)
> + return rc;
> +
> + if (!info)
> + return -ENODEV;
> +
> + if (num_bytes < 17)
> + return -EINVAL;
[Severity: Medium]
Will this length check leave partial events unsynchronized if the packet is
truncated?
If num_bytes is less than 17, this returns -EINVAL after
gip_driver_navigation.handle_input_report() has already reported events via
input_report_key(). The outer function will then skip input_sync(), leaving the
reported events stuck in the input core's buffers until the next sync.
[ ... ]
> +static int gip_handle_wheel_ll_static_configuration(struct gip_attachment *attachment,
> + const struct gip_header *header, const uint8_t *bytes, int num_bytes)
> +{
> + struct gip_wheel_info *info = attachment->driver_data;
> +
> + if (!info)
> + return -ENODEV;
> +
> + if (num_bytes < 11)
> + return -EINVAL;
> +
> + info->max_angle = BIT(min(bytes[0], 16)) / 2 - 1;
[Severity: Medium]
Could this formula cause an integer underflow if bytes[0] is 0?
If a 0-bit precision configuration is received, BIT(0) is 1, and 1 / 2 - 1
evaluates to -1, which underflows the uint16_t info->max_angle to 65535. This
could bypass validation checks and assign corrupted bounds to ABS_WHEEL.
[ ... ]
> +static int gip_handle_trueforce_wheel_report(struct gip_attachment *attachment,
> + struct input_dev *input, const uint8_t *bytes, int num_bytes)
> +{
> + int rc = gip_driver_wheel.handle_input_report(attachment, input, bytes, num_bytes);
> + struct gip_trueforce_wheel_state *state = attachment->driver_data;
> + int dial;
> +
> + if (rc < 0)
> + return rc;
> +
> + if (num_bytes < 18)
> + return -EINVAL;
[Severity: Medium]
Will this length check leave partial events unsynchronized if the packet is
truncated?
Similar to the check in gip_handle_wheel_report(), this returns -EINVAL after
the base wheel handler has already injected state changes, causing the core loop
to abort before calling input_sync().
[ ... ]
> + /* Dial states only change one at a time, so we can easily check for wraparound */
> + if (dial == 0 && state->dial == 7)
> + input_report_rel(input, REL_DIAL, -1);
> + else if (dial == 7 && state->dial == 0)
> + input_report_rel(input, REL_DIAL, 1);
> + else if (state->dial >= 0)
> + input_report_rel(input, REL_DIAL,
> + state->dial - dial);
[Severity: Medium]
Could this cause erratic relative dial jumps if the dial skips a step?
If the dial moves rapidly across the 0-7 boundary and skips a step (e.g., from
previous state 6 to current dial 0), the hardcoded wraparound checks fail. It
then falls back to state->dial - dial (6 - 0 = 6), reporting +6 instead of the
actual shortest distance of -2.
Should standard modulo arithmetic be used here instead?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260912030426.2997003-1-vi@endrift.com?part=12
prev parent reply other threads:[~2026-09-12 3:33 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 3:04 [PATCH v7 00/12] Input: xbox_gip - Add new driver for Xbox GIP Vicki Pfau
2026-09-12 3:04 ` [PATCH v7 01/12] " Vicki Pfau
2026-09-12 3:25 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 02/12] Input: xpad - Remove Xbox One support Vicki Pfau
2026-09-12 3:22 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 03/12] Input: xbox_gip - Add controllable LED support Vicki Pfau
2026-09-12 3:20 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 04/12] Input: xbox_gip - Add HID relaying Vicki Pfau
2026-09-12 3:21 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 05/12] Input: xbox_gip - Add battery support Vicki Pfau
2026-09-12 3:22 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 06/12] Input: xbox_gip - Allow sending fragmented and ACME messages Vicki Pfau
2026-09-12 3:23 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 07/12] Input: xbox_gip - Add security implementation from xone Vicki Pfau
2026-09-12 3:21 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 08/12] Input: xbox_gip - Add arcade stick support Vicki Pfau
2026-09-12 3:16 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 09/12] Input: xbox_gip - Add support for PDP guitar controllers Vicki Pfau
2026-09-12 3:23 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 10/12] Input: Add ABS_CLUTCH, HANDBRAKE, and SHIFTER Vicki Pfau
2026-09-12 3:28 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 11/12] HID: Map more automobile simulation inputs Vicki Pfau
2026-09-12 3:28 ` sashiko-bot
2026-09-12 3:04 ` [PATCH v7 12/12] Input: xbox_gip - Add wheel support Vicki Pfau
2026-09-12 3:33 ` 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=20260912033355.7B0D71F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vi@endrift.com \
/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.