public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Ameya Palande <ameya.palande@nokia.com>
To: "Contreras Felipe (Nokia-D/Helsinki)" <felipe.contreras@nokia.com>
Cc: Omar Ramirez Luna <omar.ramirez@ti.com>,
	Nishanth Menon <nm@ti.com>,
	"deepak.chitriki@ti.com" <deepak.chitriki@ti.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	"x0095840@ti.com" <x0095840@ti.com>
Subject: Re: [PATCH] DSPBRIDGE: Fix memory corruption in DRV_ProcFreeDMMRes
Date: Tue, 16 Feb 2010 14:38:43 +0200	[thread overview]
Message-ID: <1266323923.3092.14.camel@sanganak> (raw)
In-Reply-To: <20100215155958.GA5458@annwn.felipec.org>

Hi Felipe,

On Mon, 2010-02-15 at 16:59 +0100, Contreras Felipe (Nokia-D/Helsinki)
wrote:
> On Mon, Feb 15, 2010 at 04:36:31PM +0100, Ameya Palande wrote:
> > This patch fixes following issues:
> > 
> > 1. pDMMRes was dereferenced and modified when it was already freed by
> > PROC_Ummap(). This results in memory corruption.
> > 
> > 2.Instead of passing ulDSPAddr, ulDSPResAddr was passed to PROC_UnMap()
> > which will not retrieve correct DMMRes element.
> 
> You forgot to mention that this patch applies on top of your previous
> reserve resource cleanup patches.
> 
> > Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
> 
> And:
> Signed-off-by: Felipe Contreras <felipe.contreras@nokia.com>
> 
> > ---
> >  drivers/dsp/bridge/rmgr/drv.c |   15 +++++----------
> >  1 files changed, 5 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
> > index 9d5c077..747b34c 100644
> > --- a/drivers/dsp/bridge/rmgr/drv.c
> > +++ b/drivers/dsp/bridge/rmgr/drv.c
> > @@ -273,11 +273,14 @@ DSP_STATUS  DRV_ProcFreeDMMRes(HANDLE hPCtxt)
> >  		pDMMList = pDMMList->next;
> >  		if (pDMMRes->dmmAllocated) {
> >  			status = PROC_UnMap(pDMMRes->hProcessor,
> > -				 (void *)pDMMRes->ulDSPResAddr, pCtxt);
> > +				 (void *)pDMMRes->ulDSPAddr, pCtxt);
> > +			/*
> > +			 * PROC_UnMap has freed pDMMRes pointer, so don't access
> > +			 * it now
> > +			 */
> 
> I don't see the need for this comment on the code.

In above code segment, just by looking at PROC_Unmap() it is not
apparent that it will deallocate "pDMMRes" thats why that comment is
present there! I guess this whole memory corruption could have been
easily avoided by presence of that comment ;)

Cheers,
Ameya.


  reply	other threads:[~2010-02-16 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 15:36 [PATCH] DSPBRIDGE: Fix memory corruption in DRV_ProcFreeDMMRes Ameya Palande
2010-02-15 15:59 ` Felipe Contreras
2010-02-16 12:38   ` Ameya Palande [this message]
2010-02-16 17:47     ` Felipe Contreras

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=1266323923.3092.14.camel@sanganak \
    --to=ameya.palande@nokia.com \
    --cc=deepak.chitriki@ti.com \
    --cc=felipe.contreras@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=omar.ramirez@ti.com \
    --cc=x0095840@ti.com \
    /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