* [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach @ 2010-02-04 21:17 Omar Ramirez Luna 2010-02-10 13:47 ` Ameya Palande 0 siblings, 1 reply; 3+ messages in thread From: Omar Ramirez Luna @ 2010-02-04 21:17 UTC (permalink / raw) To: linux-omap Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Nishanth Menon, Ernest Ramos Falcon From: Ernest Ramos Falcon <ernesto@ti.com> This patch adds a check before calling Proc_Detach, otherwise in case a failure occurs on PROC_Attach and hProcessor is invalid when the userspace task closes its handle, unexpected behavior might be seen as this pointer is dereferenced in PROC_Detach. Signed-off-by: Ernest Ramos Falcon <ernesto@ti.com> --- drivers/dsp/bridge/rmgr/drv_interface.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c index 32aff66..b0f0d93 100644 --- a/drivers/dsp/bridge/rmgr/drv_interface.c +++ b/drivers/dsp/bridge/rmgr/drv_interface.c @@ -539,7 +539,8 @@ static int bridge_release(struct inode *ip, struct file *filp) pr_ctxt = filp->private_data; flush_signals(current); DRV_RemoveAllResources(pr_ctxt); - PROC_Detach(pr_ctxt); + if (pr_ctxt->hProcessor) + PROC_Detach(pr_ctxt); MEM_Free(pr_ctxt); filp->private_data = NULL; -- 1.6.2.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach 2010-02-04 21:17 [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach Omar Ramirez Luna @ 2010-02-10 13:47 ` Ameya Palande 2010-02-10 17:14 ` Ramos Falcon, Ernesto 0 siblings, 1 reply; 3+ messages in thread From: Ameya Palande @ 2010-02-10 13:47 UTC (permalink / raw) To: ext Omar Ramirez Luna Cc: linux-omap, Doyu Hiroshi (Nokia-D/Helsinki), Contreras Felipe (Nokia-D/Helsinki), Nishanth Menon, Ernest Ramos Falcon Hi, On Thu, 2010-02-04 at 22:17 +0100, ext Omar Ramirez Luna wrote: > From: Ernest Ramos Falcon <ernesto@ti.com> > > This patch adds a check before calling Proc_Detach, otherwise > in case a failure occurs on PROC_Attach and hProcessor is > invalid when the userspace task closes its handle, unexpected > behavior might be seen as this pointer is dereferenced in > PROC_Detach. > > Signed-off-by: Ernest Ramos Falcon <ernesto@ti.com> > --- > drivers/dsp/bridge/rmgr/drv_interface.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c > index 32aff66..b0f0d93 100644 > --- a/drivers/dsp/bridge/rmgr/drv_interface.c > +++ b/drivers/dsp/bridge/rmgr/drv_interface.c > @@ -539,7 +539,8 @@ static int bridge_release(struct inode *ip, struct file *filp) > pr_ctxt = filp->private_data; > flush_signals(current); > DRV_RemoveAllResources(pr_ctxt); > - PROC_Detach(pr_ctxt); > + if (pr_ctxt->hProcessor) > + PROC_Detach(pr_ctxt); > MEM_Free(pr_ctxt); > > filp->private_data = NULL; I guess PROC_Detach already checks for a valid hProcessor handle! Why we need this check here again? Also if you go ahead with this patch, then how are you going to cover a use case where userspace application calls PROC_Attach() which fails, but without checking the failure userspace application calls PROC_Detach()! Cheers, Ameya. ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach 2010-02-10 13:47 ` Ameya Palande @ 2010-02-10 17:14 ` Ramos Falcon, Ernesto 0 siblings, 0 replies; 3+ messages in thread From: Ramos Falcon, Ernesto @ 2010-02-10 17:14 UTC (permalink / raw) To: Ameya Palande, Ramirez Luna, Omar Cc: linux-omap, Doyu Hiroshi (Nokia-D/Helsinki), Contreras Felipe (Nokia-D/Helsinki), Menon, Nishanth >-----Original Message----- >From: Ameya Palande [mailto:ameya.palande@nokia.com] >Sent: Wednesday, February 10, 2010 7:48 AM >To: Ramirez Luna, Omar >Cc: linux-omap; Doyu Hiroshi (Nokia-D/Helsinki); Contreras Felipe (Nokia- >D/Helsinki); Menon, Nishanth; Ramos Falcon, Ernesto >Subject: Re: [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach > >Hi, > >On Thu, 2010-02-04 at 22:17 +0100, ext Omar Ramirez Luna wrote: >> From: Ernest Ramos Falcon <ernesto@ti.com> >> >> This patch adds a check before calling Proc_Detach, otherwise >> in case a failure occurs on PROC_Attach and hProcessor is >> invalid when the userspace task closes its handle, unexpected >> behavior might be seen as this pointer is dereferenced in >> PROC_Detach. >> >> Signed-off-by: Ernest Ramos Falcon <ernesto@ti.com> >> --- >> drivers/dsp/bridge/rmgr/drv_interface.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c >b/drivers/dsp/bridge/rmgr/drv_interface.c >> index 32aff66..b0f0d93 100644 >> --- a/drivers/dsp/bridge/rmgr/drv_interface.c >> +++ b/drivers/dsp/bridge/rmgr/drv_interface.c >> @@ -539,7 +539,8 @@ static int bridge_release(struct inode *ip, struct >file *filp) >> pr_ctxt = filp->private_data; >> flush_signals(current); >> DRV_RemoveAllResources(pr_ctxt); >> - PROC_Detach(pr_ctxt); >> + if (pr_ctxt->hProcessor) >> + PROC_Detach(pr_ctxt); >> MEM_Free(pr_ctxt); >> >> filp->private_data = NULL; > >I guess PROC_Detach already checks for a valid hProcessor handle! >Why we need this check here again? > Sorry, I think this applied for different version of dspbridge. >Also if you go ahead with this patch, then how are you going to cover a >use case where userspace application calls PROC_Attach() which fails, >but without checking the failure userspace application calls >PROC_Detach()! > PROC_Detach can not be called directly from user space, is deprecated; the only place where this is function is called is bridge_release, so nothing would happen. Anyway, dismiss this patch. >Cheers, >Ameya. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-10 17:15 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-02-04 21:17 [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach Omar Ramirez Luna 2010-02-10 13:47 ` Ameya Palande 2010-02-10 17:14 ` Ramos Falcon, Ernesto
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox