All of lore.kernel.org
 help / color / mirror / Atom feed
From: mzoran@crowfest.net (Michael Zoran)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] staging: vc04_services: rework ioctl code path
Date: Mon, 14 Nov 2016 10:28:38 -0800	[thread overview]
Message-ID: <1479148118.22585.1.camel@crowfest.net> (raw)
In-Reply-To: <20161111134646.GI28701@mwanda>

On Mon, 2016-11-14 at 12:48 +0300, Dan Carpenter wrote:
> On Thu, Nov 10, 2016 at 10:15:31PM -0800, Michael Zoran wrote:
> > +static void *
> > +vchiq_ioctl_kmalloc(struct vchiq_ioctl_call_context *ctxt, size_t
> > size)
> > +{
> > +	void *mem;
> > +
> > +	if (!ctxt->stackmem_used && size < sizeof(ctxt->stackmem)) 
> > {
> > +		ctxt->stackmem_used = true;
> > +		return ctxt->stackmem;
> > +	}
> > +
> > +	mem = kmalloc(size + sizeof(void *), GFP_KERNEL);
> 
> This is a potential integer overflow leading to corruption.??I don't
> understand why we need this complicated memory management anyway...
> 

You could be right.  This patch was very large and it hasn't received
the review that it probably should get.   Also the checkpatch.pl
utility is complaining about obsolete kernel functionality that the old
code had and I really don't have the time to redo.

Perhaps the entire patch should be removed from consideration until I
can possibly work out a V3?

> > +	if (!mem)
> > +		return NULL;
> > +
> > +	*(void **)mem = ctxt->prev_kmalloc;
> > +	ctxt->prev_kmalloc = mem;
> > +
> > +	return mem + sizeof(void *);
> > +}
> 
> regards,
> dan carpenter

  reply	other threads:[~2016-11-14 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11  6:15 [PATCH v2] staging: vc04_services: rework ioctl code path Michael Zoran
2016-11-12 17:45 ` Stefan Wahren
2016-11-14  9:48 ` Dan Carpenter
2016-11-14 18:28   ` Michael Zoran [this message]
2016-11-15  9:55 ` Greg KH
2016-11-15 21:27   ` Michael Zoran
2016-11-16  6:53     ` Greg KH

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=1479148118.22585.1.camel@crowfest.net \
    --to=mzoran@crowfest.net \
    --cc=linux-arm-kernel@lists.infradead.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.