From: Ameya Palande <ameya.palande@nokia.com>
To: ext Omar Ramirez Luna <omar.ramirez@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
"Doyu Hiroshi (Nokia-D/Helsinki)" <hiroshi.doyu@nokia.com>,
"Contreras Felipe (Nokia-D/Helsinki)"
<felipe.contreras@nokia.com>, Nishanth Menon <nm@ti.com>,
Ernest Ramos Falcon <ernesto@ti.com>
Subject: Re: [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach
Date: Wed, 10 Feb 2010 15:47:39 +0200 [thread overview]
Message-ID: <1265809659.30481.52.camel@sanganak> (raw)
In-Reply-To: <1265318253-20308-1-git-send-email-omar.ramirez@ti.com>
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.
next prev parent reply other threads:[~2010-02-10 13:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 21:17 [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach Omar Ramirez Luna
2010-02-10 13:47 ` Ameya Palande [this message]
2010-02-10 17:14 ` Ramos Falcon, Ernesto
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=1265809659.30481.52.camel@sanganak \
--to=ameya.palande@nokia.com \
--cc=ernesto@ti.com \
--cc=felipe.contreras@nokia.com \
--cc=hiroshi.doyu@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=omar.ramirez@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