From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: itewqq <shipeiqu@sjtu.edu.cn>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
viro@zeniv.linux.org.uk, ye.xingchen@zte.com.cn
Subject: Re: [PATCH v2] Input/mouse: cyapa - fix potential buffer overflow in cyapa_gen3.c
Date: Thu, 17 Oct 2024 17:31:58 -0700 [thread overview]
Message-ID: <ZxGsfjTpw8KkbXtt@google.com> (raw)
In-Reply-To: <20241017080104.1817636-1-shipeiqu@sjtu.edu.cn>
Hi,
On Thu, Oct 17, 2024 at 04:01:04PM +0800, itewqq wrote:
> The i2c_smbus_read_block_data function receives up to I2C_SMBUS_BLOCK_MAX
> bytes, which is defined as 32. This exceeds the size of the struct
> cyapa_reg_data, which will be provided to cyapa_read_block as an input
> buffer and finally reach i2c_smbus_read_block_data. When the cyapa module
> is enabled (CONFIG_MOUSE_CYAPA=m), this bug could result in potential
> denial-of-service for invalid or malicious I2C data. Pad the size of the
> cyapa_reg_data structure from 27 to I2C_SMBUS_BLOCK_MAX=32 bytes to
> address this issue.
No, I don't think padding all buffers is a good idea. We need to change
i2c_smbus_read_block_data() to accept the buffer size so that it does
not copy more than it should.
I sent a patch to i2c list and CCed you.
Thanks.
--
Dmitry
prev parent reply other threads:[~2024-10-18 0:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 10:07 [PATCH] Input/mouse: cyapa - fix stack overflow bug in cyapa_gen3_get_query_data itewqq
2024-10-17 8:01 ` [PATCH v2] Input/mouse: cyapa - fix potential buffer overflow in cyapa_gen3.c itewqq
2024-10-18 0:31 ` Dmitry Torokhov [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=ZxGsfjTpw8KkbXtt@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shipeiqu@sjtu.edu.cn \
--cc=viro@zeniv.linux.org.uk \
--cc=ye.xingchen@zte.com.cn \
/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.