From: Dan Carpenter <dan.carpenter@oracle.com>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] firewire: prevent integer overflow on 32bit systems
Date: Wed, 3 Mar 2021 08:22:40 +0300 [thread overview]
Message-ID: <20210303052239.GY2222@kadam> (raw)
In-Reply-To: <20210302221911.6c1582e2@kant>
On Tue, Mar 02, 2021 at 10:19:11PM +0100, Stefan Richter wrote:
> On Mar 02 Dan Carpenter wrote:
> > In TCODE_STREAM_DATA mode, on 32bit systems, the "sizeof(*e) +
> > request->length" operation can overflow leading to memory corruption.
> >
> > Fixes: 18e9b10fcdc0 ("firewire: cdev: add closure to async stream ioctl")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > drivers/firewire/core-cdev.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
> > index fb6c651214f3..314de0384035 100644
> > --- a/drivers/firewire/core-cdev.c
> > +++ b/drivers/firewire/core-cdev.c
> > @@ -587,6 +587,9 @@ static int init_request(struct client *client,
> > request->length < 4)
> > return -EINVAL;
> >
> > + if (request->length > ULONG_MAX - sizeof(*e))
> > + return -EINVAL;
> > +
> > e = kmalloc(sizeof(*e) + request->length, GFP_KERNEL);
> > if (e == NULL)
> > return -ENOMEM;
>
> There is already a length check for asynchronous stream requests.
> It happens in ioctl_send_stream_packet().
Oh, yeah. You're right. I should have looked more carefully. Sorry.
regards,
dan carpenter
next prev parent reply other threads:[~2021-03-03 12:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 11:18 [PATCH] firewire: prevent integer overflow on 32bit systems Dan Carpenter
2021-03-02 21:19 ` Stefan Richter
2021-03-03 5:22 ` Dan Carpenter [this message]
2021-03-03 17:31 ` kernel test robot
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=20210303052239.GY2222@kadam \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=stefanr@s5r6.in-berlin.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