From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Shen Yongchao <grayhat@foxmail.com>,
linux-input@vger.kernel.org, Zhang Lixu <lixu.zhang@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] HID: intel-ish-hid: fix report_list iterator pointer arithmetic
Date: Thu, 30 Jul 2026 11:08:44 -0700 [thread overview]
Message-ID: <8836d77de5c2de98876f49a866a7f149c49fff89.camel@linux.intel.com> (raw)
In-Reply-To: <tencent_F203F6206515915C81D1210ECEBCBCA5D707@qq.com>
+Lixu
On Thu, 2026-07-30 at 20:52 +0800, Shen Yongchao wrote:
> Since commit 63cafaf47a83 ("HID: ishtp-hid-client: replace
> fake-flex arrays with flex-array members", v6.13), the
> HOSTIF_PUBLISH_INPUT_REPORT_LIST handler iterates over sub-reports
> using a struct report * pointer:
>
> report += sizeof(*report) + payload_len;
>
> Because report is a struct report * (not a char *), the compiler
> multiplies the advance by sizeof(struct report) = 8, making the
> actual stride (8 + payload_len) * 8 bytes instead of the intended
> 8 + payload_len bytes. On v6.13+ a legitimate aggregated list
> with num_of_reports >= 2 drives the second iteration far outside
> the message buffer.
>
> Replace the struct report * iterator with a byte-granular u8 *pos
> so the advance is computed in bytes.
>
>
> Assisted-by: LLM
Need to follow:
https://docs.kernel.org/process/coding-assistants.html
Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]
Lixu,
Please give a test on few devices. Not sure if we have such device.
Thanks,
Srinivas
> Signed-off-by: Shen Yongchao <grayhat@foxmail.com>
> Fixes: 63cafaf47a83 ("HID: ishtp-hid-client: replace fake-flex arrays
> with flex-array members")
> Cc: stable@vger.kernel.org
> ---
> diff --git a/drivers/hid/intel-ish-hid/ishtp-hid-client.c
> b/drivers/hid/intel-ish-hid/ishtp-hid-client.c
> index 6d64008f2..ba52e185c 100644
> --- a/drivers/hid/intel-ish-hid/ishtp-hid-client.c
> +++ b/drivers/hid/intel-ish-hid/ishtp-hid-client.c
> @@ -74,6 +74,7 @@ static void process_recv(struct ishtp_cl
> *hid_ishtp_cl, void *recv_buf,
> int report_type;
> struct report_list *reports_list;
> struct report *report;
> + u8 *pos;
> size_t report_len;
> struct ishtp_cl_data *client_data =
> ishtp_get_client_data(hid_ishtp_cl);
> int curr_hid_dev = client_data->cur_hid_dev;
> @@ -280,9 +281,10 @@ static void process_recv(struct ishtp_cl
> *hid_ishtp_cl, void *recv_buf,
> case HOSTIF_PUBLISH_INPUT_REPORT_LIST:
> report_type = HID_INPUT_REPORT;
> reports_list = (struct report_list
> *)payload;
> - report = reports_list->reports;
> + pos = (u8 *)reports_list->reports;
>
> for (j = 0; j < reports_list-
> >num_of_reports; j++) {
> + report = (struct report *)pos;
> recv_msg = container_of(&report-
> >msg,
> struct
> hostif_msg, hdr);
> report_len = report->size;
> @@ -303,7 +305,7 @@ static void process_recv(struct ishtp_cl
> *hid_ishtp_cl, void *recv_buf,
> 0);
> }
>
> - report += sizeof(*report) +
> payload_len;
> + pos += sizeof(struct report) +
> payload_len;
> }
> break;
> default:
> @@ -956,4 +958,4 @@ MODULE_AUTHOR("Daniel Drubin
> <daniel.drubin@intel.com>");
> */
> MODULE_AUTHOR("Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com>");
>
> -MODULE_LICENSE("GPL");
> +MODULE_LICENSE("GPL");
> \ No newline at end of file
next prev parent reply other threads:[~2026-07-30 18:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260730115600.218172-1-grayhat@foxmail.com>
2026-07-30 12:52 ` Shen Yongchao
2026-07-30 18:08 ` srinivas pandruvada [this message]
2026-07-31 1:39 ` grayhat
2026-07-31 6:47 ` Zhang, Lixu
2026-07-30 12:52 ` [PATCH v2 2/4] HID: intel-ish-hid: bound report_list iteration to message size Shen Yongchao
2026-07-30 12:52 ` [PATCH v2 3/4] HID: intel-ish-hid: prevent size_t underflow in report_list parsing Shen Yongchao
2026-07-30 12:52 ` [PATCH v2 4/4] HID: intel-ish-hid: add full entry bounds check to " Shen Yongchao
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=8836d77de5c2de98876f49a866a7f149c49fff89.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=bentiss@kernel.org \
--cc=grayhat@foxmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lixu.zhang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome