netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix possible null pointer dereference in davinci_cpdma.c
@ 2011-03-14  8:39 huzaifas
  2011-03-14 22:36 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: huzaifas @ 2011-03-14  8:39 UTC (permalink / raw)
  To: netdev; +Cc: khilman, cyril, Huzaifa Sidhpurwala

From: Huzaifa Sidhpurwala <huzaifas@redhat.com>

Check if chan exists before dereferencing it

Signed-off-by: Huzaifa Sidhpurwala <huzaifas@redhat.com>
---
 drivers/net/davinci_cpdma.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/davinci_cpdma.c b/drivers/net/davinci_cpdma.c
index e92b2b6..09620a6 100644
--- a/drivers/net/davinci_cpdma.c
+++ b/drivers/net/davinci_cpdma.c
@@ -526,12 +526,13 @@ err_chan_alloc:
 
 int cpdma_chan_destroy(struct cpdma_chan *chan)
 {
-	struct cpdma_ctlr *ctlr = chan->ctlr;
+	struct cpdma_ctlr *ctlr;
 	unsigned long flags;
 
 	if (!chan)
 		return -EINVAL;
 
+	ctrl = chan->ctrl;
 	spin_lock_irqsave(&ctlr->lock, flags);
 	if (chan->state != CPDMA_STATE_IDLE)
 		cpdma_chan_stop(chan);
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix possible null pointer dereference in davinci_cpdma.c
  2011-03-14  8:39 [PATCH] Fix possible null pointer dereference in davinci_cpdma.c huzaifas
@ 2011-03-14 22:36 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-03-14 22:36 UTC (permalink / raw)
  To: huzaifas; +Cc: netdev, khilman, cyril

From: huzaifas@redhat.com
Date: Mon, 14 Mar 2011 14:09:14 +0530

> From: Huzaifa Sidhpurwala <huzaifas@redhat.com>
> 
> Check if chan exists before dereferencing it
> 
> Signed-off-by: Huzaifa Sidhpurwala <huzaifas@redhat.com>

Just like your EHEA driver patch, this situation is such that
cpdma_chan_destroy() is never called with a NULL "chan" argument.

Therefore it's better to simply remove the NULL check.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-14 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-14  8:39 [PATCH] Fix possible null pointer dereference in davinci_cpdma.c huzaifas
2011-03-14 22:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).