All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arie Miller" <renari@arimil.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 3/3] hwmon: (asus_rog_ryujin) Add ROG Ryujin III White Edition
Date: Fri, 07 Aug 2026 00:10:52 +0000	[thread overview]
Message-ID: <20260807001053.2052C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807000107.1786892-4-renari@arimil.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

Pre-existing issues:
- [High] Hardware and input processing are started before wait queue completions are initialized, leading to potential NULL pointer dereferences.
- [High] The spinlock `status_report_request_lock` provides no mutual exclusion against the raw event handler, leading to race conditions with completions.
- [High] The raw event handler fails to validate the size of incoming HID reports.
- [High] The driver updates and reads shared sensor data fields concurrently between `rog_ryujin_raw_event` and sysfs operations without using the mandated `hwmon_lock()`.
--

--- Patch [3]: [PATCH 3/3] hwmon: (asus_rog_ryujin) Add ROG Ryujin III White Edition ---
commit 7de73211f5a55165f52d68bf9aae14fa4ccb23f0
Author: Will Smith <github@notthatwillsmith.com>

hwmon: (asus_rog_ryujin) Add ROG Ryujin III White Edition

This commit adds support for the ROG Ryujin III White Edition liquid cooler.
It adds the USB device ID to the hardware monitoring driver and updates the
documentation.

Link: https://github.com/aleksamagicka/asus_rog_ryujin-hwmon/pull/10

> diff --git a/drivers/hwmon/asus_rog_ryujin.c b/drivers/hwmon/asus_rog_ryujin.c
> --- a/drivers/hwmon/asus_rog_ryujin.c
> +++ b/drivers/hwmon/asus_rog_ryujin.c

[ ... ]

> @@ -587,6 +588,8 @@ static const struct hid_device_id rog_ryujin_table[] = {
>  	  .driver_data = (kernel_ulong_t)&rog_ryujin_iii_info },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS_ROG, USB_PRODUCT_ID_RYUJIN_III_EVA),
>  	  .driver_data = (kernel_ulong_t)&rog_ryujin_iii_info },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS_ROG, USB_PRODUCT_ID_RYUJIN_III_WHITE),
> +	  .driver_data = (kernel_ulong_t)&rog_ryujin_iii_info },
>  	{ }
>  };

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this driver I 
noticed a pre-existing issue with hardware initialization.

In rog_ryujin_probe(), event polling is started before the wait queue
completions are initialized:

    ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
    ...
    init_completion(&priv->cooler_status_received);

Could this lead to a NULL pointer dereference or list corruption if the
device sends an early report and rog_ryujin_raw_event() calls complete_all()
on the uninitialized completion?

[Severity: High]
This is a pre-existing issue, but does the status_report_request_lock provide
adequate mutual exclusion?

In rog_ryujin_execute_cmd(), the lock is taken when reinitializing completions:

    spin_lock_bh(&priv->status_report_request_lock);
    reinit_completion(status_completion);
    spin_unlock_bh(&priv->status_report_request_lock);

However, in rog_ryujin_raw_event(), complete_all() is called without
acquiring this lock. Can this lead to race conditions with the completion
state being clobbered, potentially causing sysfs reads to hang and return
-ETIMEDOUT?

[Severity: High]
This isn't a bug introduced by this patch, but is it possible for an
out-of-bounds read to occur when parsing the HID report?

In rog_ryujin_raw_event(), the incoming report is parsed directly:

    if (data[1] == RYUJIN_GET_COOLER_STATUS_CMD_RESPONSE) {
        priv->temp_input[0] = data[priv->info->temp_offset] * 1000 +

Should the size parameter be validated before accessing data offsets to
prevent exposing stale or uninitialized memory if a truncated packet is
received?

[Severity: High]
This is a pre-existing issue, but does this driver violate the hwmon
subsystem locking guidelines?

The driver updates and reads shared sensor data fields concurrently between
rog_ryujin_raw_event() and sysfs operations:

    priv->temp_input[0] = data[priv->info->temp_offset] * 1000 +
        data[priv->info->temp_offset + 1] * 100;

And in rog_ryujin_read():

    *val = priv->temp_input[channel];

Are hwmon_lock() and hwmon_unlock() required here to synchronize the
attribute access, as mandated for hardware monitoring drivers?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260807000107.1786892-1-renari@arimil.com?part=3

      reply	other threads:[~2026-08-07  0:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  0:01 [PATCH 0/3] hwmon: Add ASUS ROG Ryujin III support Arie Miller
2026-08-07  0:01 ` [PATCH 1/3] hwmon: (asus_rog_ryujin) Add per-device configuration Arie Miller
2026-08-07  0:14   ` sashiko-bot
2026-08-09 16:37     ` Guenter Roeck
     [not found]       ` <CADBHdQ3x4bFe518q2PjZvGJ2=qP45+5Cmm8f99J9gRZCJun0aQ@mail.gmail.com>
2026-08-09 20:25         ` Arimil
2026-08-09 21:23         ` Guenter Roeck
2026-08-09 22:03           ` Arimil
2026-08-09 22:54             ` Guenter Roeck
2026-08-10  1:08               ` Arimil
2026-08-10  1:19                 ` Guenter Roeck
2026-08-10  1:58                   ` Arimil
2026-08-07  0:01 ` [PATCH 2/3] hwmon: (asus_rog_ryujin) Add ROG Ryujin III support Arie Miller
2026-08-07  0:12   ` sashiko-bot
2026-08-07  0:01 ` [PATCH 3/3] hwmon: (asus_rog_ryujin) Add ROG Ryujin III White Edition Arie Miller
2026-08-07  0:10   ` 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=20260807001053.2052C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=renari@arimil.com \
    --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.