All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <andrea.righi@canonical.com>
To: Wolfram Sang <wsa@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Phoenix Huang <phoenix@emc.com.tw>,
	jingle.wu@emc.com.tw,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] Input: elantech - Fix stack out of bound access in elantech_change_report_id()
Date: Tue, 16 Nov 2021 10:53:09 +0100	[thread overview]
Message-ID: <YZN/hXipFP7Ipb7G@arighi-desktop> (raw)
In-Reply-To: <YZNsoj7Onbxr68OQ@ninjato>

On Tue, Nov 16, 2021 at 09:32:34AM +0100, Wolfram Sang wrote:
> On Tue, Nov 16, 2021 at 08:22:23AM +0100, Andrea Righi wrote:
> > The array param[] in elantech_change_report_id() must be at least 3
> > bytes, because elantech_read_reg_params() is calling ps2_command() with
> > PSMOUSE_CMD_GETINFO, that is going to access 3 bytes from param[], but
> > it's defined in the stack as an array of 2 bytes, therefore we have a
> > potential stack out-of-bounds access here, also confirmed by KASAN:
> 
> I think a comment in the code why the array size is 3 when only 2 values
> are defined would be helpful. Like a short summary of the above.
> 

Good idea, I like it, I'll send a v2 adding such comment.

Thanks!
-Andrea

      reply	other threads:[~2021-11-16  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16  7:22 [RESEND PATCH] Input: elantech - Fix stack out of bound access in elantech_change_report_id() Andrea Righi
2021-11-16  8:32 ` Wolfram Sang
2021-11-16  9:53   ` Andrea Righi [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=YZN/hXipFP7Ipb7G@arighi-desktop \
    --to=andrea.righi@canonical.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jingle.wu@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phoenix@emc.com.tw \
    --cc=wsa@kernel.org \
    /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.