From: Dan Carpenter <dan.carpenter@oracle.com>
To: Wolfram Sang <wsa@kernel.org>
Cc: Johan Hovold <johan@kernel.org>, Lee Jones <lee.jones@linaro.org>,
Octavian Purdila <octavian.purdila@intel.com>,
Laurentiu Palcu <laurentiu.palcu@intel.com>,
linux-i2c@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] i2c: dln2: prevent buffer overflow in dln2_i2c_write()
Date: Fri, 14 Oct 2022 17:25:37 +0300 [thread overview]
Message-ID: <Y0lxYa+Fxn1fM/4G@kadam> (raw)
In-Reply-To: <Y0bUYc2fadLgoQfZ@kili>
On Wed, Oct 12, 2022 at 05:51:13PM +0300, Dan Carpenter wrote:
> The "data_len" value is use controlled via the ioctl. It needs to
> be bounds checked to prevent a buffer overflow.
>
> Fixes: db23e5001f75 ("i2c: add support for Diolan DLN-2 USB-I2C adapter")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/i2c/busses/i2c-dln2.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c
> index 2a2089db71a5..14f4aeeb263d 100644
> --- a/drivers/i2c/busses/i2c-dln2.c
> +++ b/drivers/i2c/busses/i2c-dln2.c
> @@ -83,6 +83,9 @@ static int dln2_i2c_write(struct dln2_i2c *dln2, u8 addr,
>
> BUILD_BUG_ON(sizeof(*tx) > DLN2_I2C_BUF_SIZE);
>
> + if (data_len > sizeof(tx->buf))
> + return -EINVAL;
Never mind. This is checked in i2c_check_for_quirks() so the patch is
not required. My bad.
regards,
dan carpenter
prev parent reply other threads:[~2022-10-14 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 14:51 [PATCH] i2c: dln2: prevent buffer overflow in dln2_i2c_write() Dan Carpenter
2022-10-14 14:25 ` Dan Carpenter [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=Y0lxYa+Fxn1fM/4G@kadam \
--to=dan.carpenter@oracle.com \
--cc=johan@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=laurentiu.palcu@intel.com \
--cc=lee.jones@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=octavian.purdila@intel.com \
--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.