LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Alexander Popov <alex.popov@linux.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
sil2review@lists.osadl.org, "Dmitry Vyukov" <dvyukov@google.com>,
syzkaller@googlegroups.com
Subject: Re: [v2 1/1] i2c: dev: prevent ZERO_SIZE_PTR deref in i2cdev_ioctl_rdwr()
Date: Fri, 27 Apr 2018 14:06:58 +0200 [thread overview]
Message-ID: <20180427120658.wi32f7margtfazzp@ninjato> (raw)
In-Reply-To: <1524140962-25639-1-git-send-email-alex.popov@linux.com>
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
On Thu, Apr 19, 2018 at 03:29:22PM +0300, Alexander Popov wrote:
> i2cdev_ioctl_rdwr() allocates i2c_msg.buf using memdup_user(), which
> returns ZERO_SIZE_PTR if i2c_msg.len is zero.
>
> Currently i2cdev_ioctl_rdwr() always dereferences the buf pointer in case
> of I2C_M_RD | I2C_M_RECV_LEN transfer. That causes a kernel oops in
> case of zero len.
>
> Let's check the len against zero before dereferencing buf pointer.
>
> This issue was triggered by syzkaller.
>
> Signed-off-by: Alexander Popov <alex.popov@linux.com>
Applied to for-current with the arithmetic expression changed to '< 1'
to keep in sync with the previous one. Will push out soon, so you can
double check if you are interested.
Thanks for the debugging, Alexander!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-04-27 12:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 12:29 Alexander Popov
2018-04-19 13:49 ` Uwe Kleine-König
2018-04-19 17:01 ` Alexander Popov
2018-04-20 5:58 ` Uwe Kleine-König
2018-04-23 20:18 ` Alexander Popov
2018-04-27 12:06 ` Wolfram Sang [this message]
2018-04-30 7:13 ` Uwe Kleine-König
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=20180427120658.wi32f7margtfazzp@ninjato \
--to=wsa@the-dreams.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=syzkaller@googlegroups.com \
--cc=u.kleine-koenig@pengutronix.de \
--subject='Re: [v2 1/1] i2c: dev: prevent ZERO_SIZE_PTR deref in i2cdev_ioctl_rdwr()' \
/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
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).