public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: Ameya Palande <ameya.palande@nokia.com>,
	Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
	Felipe Contreras <felipe.contreras@nokia.com>,
	Nishanth Menon <nm@ti.com>, Ernest Ramos Falcon <ernesto@ti.com>
Subject: [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach
Date: Thu,  4 Feb 2010 15:17:33 -0600	[thread overview]
Message-ID: <1265318253-20308-1-git-send-email-omar.ramirez@ti.com> (raw)

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


             reply	other threads:[~2010-02-04 21:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04 21:17 Omar Ramirez Luna [this message]
2010-02-10 13:47 ` [PATCH] DSPBRIDGE: check pointer before calling Proc_Detach Ameya Palande
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=1265318253-20308-1-git-send-email-omar.ramirez@ti.com \
    --to=omar.ramirez@ti.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=ameya.palande@nokia.com \
    --cc=ernesto@ti.com \
    --cc=felipe.contreras@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@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