netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: j223yang@asset.uwaterloo.ca
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch]iwch_cm: fix possible null pointer
Date: Thu, 10 Mar 2011 12:23:48 -0500	[thread overview]
Message-ID: <20110310172348.GA10787@asset.uwaterloo.ca> (raw)

This patch fixes bugzilla #9583:
https://bugzilla.kernel.org/show_bug.cgi?id=9583

The patch adds NULL check for 'ep->com.cm_id' before derefenrence, since
'ep->com.cm_id' is testing for NULL before. But it depends on the relationship
between 'status' and 'ep->com.cm_id'.

Signed-off-by: Jinqiu Yang<crindy646@gmail.com>
---
 iwch_cm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c	2011-03-10 11:20:13.641039456 -0500
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c	2011-03-10 11:39:03.346164807 -0500
@@ -746,7 +746,8 @@ static void connect_reply_upcall(struct 
 		ep->com.cm_id->event_handler(ep->com.cm_id, &event);
 	}
 	if (status < 0) {
-		ep->com.cm_id->rem_ref(ep->com.cm_id);
+		if (ep->com.cm_id)
+			ep->com.cm_id->rem_ref(ep->com.cm_id);
 		ep->com.cm_id = NULL;
 		ep->com.qp = NULL;
 	}

                 reply	other threads:[~2011-03-10 17:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20110310172348.GA10787@asset.uwaterloo.ca \
    --to=j223yang@asset.uwaterloo.ca \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).