Linux Input/HID development
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Zhang Lixu <lixu.zhang@intel.com>, Maoyi Xie <maoyixie.tju@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v2 1/2] HID: intel-ish-hid: Reallocate the descriptor buffers for a longer response
Date: Fri, 04 Dec 2026 11:02:16 -0800	[thread overview]
Message-ID: <677463758ef7c94752edff0cb1740943cf2bbeb7.camel@linux.intel.com> (raw)
In-Reply-To: <axJUpBN4jk_0-vK0@lixuzha-desk.sh.intel.com>

On Fri, 2026-12-04 at 13:52 +0800, Zhang Lixu wrote:
> On Wed, Nov 25, 2026 at 05:06:32PM +0800, Maoyi Xie wrote:
> > process_recv() allocates hid_descr[i] and report_descr[i] only when
> > they
> > are NULL. It then copies each response into them with the length of
> > that response. After an ISH reset, a longer descriptor for the same
> > index can overflow the buffer allocated for the first response. A
> > second, longer response to one request does the same.
> > 
> > Size the buffer to the received length with devm_krealloc() before
> > the
> > copy. Ignore a response whose done flag is already set.
> > ishtp_hid_parse() may be reading the report descriptor at that
> > point.
> > 
> > Found with a CodeQL-based static analysis tool that we are
> > developing.
> > Reproduced in a userspace harness under AddressSanitizer. Not
> > tested on
> > hardware.
> > 
> > Fixes: 0b28cb4bcb17 ("HID: intel-ish-hid: ISH HID client driver")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
> 
> Looks good to me. Tested on Intel PTL ISH hardware across repeated
> firmware resets, module reload.
> 
> Reviewed-by: Zhang Lixu <lixu.zhang@intel.com>
> Tested-by: Zhang Lixu <lixu.zhang@intel.com>
> 
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> > ---
> > v2:
> > - Ignore a response whose done flag is already set (Sashiko
> > review).
> > - Shorten the commit message.
> > v1:
> > https://lore.kernel.org/linux-input/20261123092816.2200718-2-maoyixie.tju@gmail.com/

  reply	other threads:[~2026-12-04 19:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  9:06 [PATCH v2 0/2] HID: intel-ish-hid: Size the buffers for a later, larger response Maoyi Xie
2026-11-25  9:06 ` [PATCH v2 1/2] HID: intel-ish-hid: Reallocate the descriptor buffers for a longer response Maoyi Xie
2026-12-04  5:52   ` Zhang Lixu
2026-12-04 19:02     ` Srinivas Pandruvada [this message]
2026-11-25  9:06 ` [PATCH v2 2/2] HID: intel-ish-hid: Allocate hid_devices for the largest device count Maoyi Xie
2026-12-04  6:42   ` Zhang Lixu

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=677463758ef7c94752edff0cb1740943cf2bbeb7.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=lixu.zhang@intel.com \
    --cc=maoyixie.tju@gmail.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