From: Arne Redlich <arne.redlich@xiranet.com>
To: Roland Dreier <rolandd@cisco.com>
Cc: ofa-general <general@lists.openfabrics.org>,
lkml <linux-kernel@vger.kernel.org>,
erezz@voltaire.com
Subject: Re: [PATCH 2/2] IB/iSER: handle iser_device allocation error gracefully
Date: Mon, 03 Mar 2008 11:36:26 +0100 [thread overview]
Message-ID: <87zltgw0ut.fsf@confield.dd.xiranet.com> (raw)
"iser_device" allocation failure is "handled" with a BUG_ON() right
before dereferencing the NULL-pointer - fix this!
Signed-off-by: Arne Redlich <arne.redlich@xiranet.com>
---
drivers/infiniband/ulp/iser/iser_verbs.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 1c0f968..cf70d15 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -243,7 +243,7 @@ struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
list_for_each_entry(device, &ig.device_list, ig_list)
if (device->ib_device->node_guid == cma_id->device->node_guid)
- goto out;
+ goto inc_refcnt;
device = kzalloc(sizeof *device, GFP_KERNEL);
if (device == NULL)
@@ -258,9 +258,9 @@ struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
}
list_add(&device->ig_list, &ig.device_list);
-out:
- BUG_ON(device == NULL);
+inc_refcnt:
device->refcount++;
+out:
mutex_unlock(&ig.device_list_mutex);
return device;
}
@@ -366,6 +366,12 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
int ret;
device = iser_device_find_by_ib_device(cma_id);
+ if (!device) {
+ iser_err("device lookup/creation failed\n");
+ iser_connect_error(cma_id);
+ return;
+ }
+
ib_conn = (struct iser_conn *)cma_id->context;
ib_conn->device = device;
@@ -374,7 +380,6 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
iser_err("resolve route failed: %d\n", ret);
iser_connect_error(cma_id);
}
- return;
}
static void iser_route_handler(struct rdma_cm_id *cma_id)
--
1.5.4.1
next reply other threads:[~2008-03-03 10:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-03 10:36 Arne Redlich [this message]
2008-03-04 12:11 ` Erez Zilber
2008-03-11 4:18 ` Roland Dreier
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=87zltgw0ut.fsf@confield.dd.xiranet.com \
--to=arne.redlich@xiranet.com \
--cc=erezz@voltaire.com \
--cc=general@lists.openfabrics.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rolandd@cisco.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
Powered by JetHome