From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Alexander Popov <alex.popov@linux.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
sil2review@lists.osadl.org, Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH 1/1] i2c: dev: check i2c_msg len before memdup_user() to prevent ZERO_SIZE_PTR deref
Date: Wed, 18 Apr 2018 09:07:04 +0200 [thread overview]
Message-ID: <20180418070704.35zj5chpdkirnmdt@pengutronix.de> (raw)
In-Reply-To: <1524010605-21552-1-git-send-email-alex.popov@linux.com>
Hello,
On Wed, Apr 18, 2018 at 03:16:45AM +0300, Alexander Popov wrote:
> Currently i2cdev_ioctl_rdwr() doesn't check i2c_msg len against zero
> before calling memdup_user(). If this len is zero memdup_user() returns
> ZERO_SIZE_PTR, which is later considered as valid since
> IS_ERR(ZERO_SIZE_PTR) is false. That causes ZERO_SIZE_PTR deref oops.
You're saying that
memdup_user(ptr, 0)
reads from *ptr? I'd say this is a bug in memdup_user, not its user.
If however the problem only happens later in
if (msgs[i].flags & I2C_M_RECV_LEN) {
if (!(msgs[i].flags & I2C_M_RD) || msgs[i].buf[0] < 1 || ...)
Your commit log is wrong (and I think the patch, too).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2018-04-18 7:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 0:16 [PATCH 1/1] i2c: dev: check i2c_msg len before memdup_user() to prevent ZERO_SIZE_PTR deref Alexander Popov
2018-04-18 7:07 ` Uwe Kleine-König [this message]
2018-04-18 7:56 ` Alexander Popov
2018-04-18 8:23 ` Uwe Kleine-König
2018-04-18 13:00 ` Alexander Popov
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=20180418070704.35zj5chpdkirnmdt@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=alex.popov@linux.com \
--cc=dvyukov@google.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sil2review@lists.osadl.org \
--cc=wsa@the-dreams.de \
/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;
as well as URLs for NNTP newsgroup(s).