mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [git patch review 1/2] IB/uverbs: Release event file reference on ib_uverbs_create_cq() error
@ 2006-01-07 17:07 Roland Dreier
  2006-01-07 17:07 ` [git patch review 2/2] IB: Set GIDs correctly in ib_create_ah_from_wc() Roland Dreier
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2006-01-07 17:07 UTC (permalink / raw)
  To: linux-kernel, openib-general

ib_uverbs_create_cq() should release the completion channel event file
if an error occurs after it looks it up.  Also, if userspace asks for
a completion channel and we don't find it, an error should be returned
instead of silently creating a CQ without a completion channel.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/core/uverbs_cmd.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

ac4e7b35579de55db50d602a472858867808a9c3
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 12d6cc0..a02c5a0 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -594,13 +594,18 @@ ssize_t ib_uverbs_create_cq(struct ib_uv
 	if (cmd.comp_vector >= file->device->num_comp_vectors)
 		return -EINVAL;
 
-	if (cmd.comp_channel >= 0)
-		ev_file = ib_uverbs_lookup_comp_file(cmd.comp_channel);
-
 	uobj = kmalloc(sizeof *uobj, GFP_KERNEL);
 	if (!uobj)
 		return -ENOMEM;
 
+	if (cmd.comp_channel >= 0) {
+		ev_file = ib_uverbs_lookup_comp_file(cmd.comp_channel);
+		if (!ev_file) {
+			ret = -EINVAL;
+			goto err;
+		}
+	}
+
 	uobj->uobject.user_handle   = cmd.user_handle;
 	uobj->uobject.context       = file->ucontext;
 	uobj->uverbs_file	    = file;
@@ -664,6 +669,8 @@ err_up:
 	ib_destroy_cq(cq);
 
 err:
+	if (ev_file)
+		ib_uverbs_release_ucq(file, ev_file, uobj);
 	kfree(uobj);
 	return ret;
 }
-- 
0.99.9n

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

* [git patch review 2/2] IB: Set GIDs correctly in ib_create_ah_from_wc()
  2006-01-07 17:07 [git patch review 1/2] IB/uverbs: Release event file reference on ib_uverbs_create_cq() error Roland Dreier
@ 2006-01-07 17:07 ` Roland Dreier
  0 siblings, 0 replies; 2+ messages in thread
From: Roland Dreier @ 2006-01-07 17:07 UTC (permalink / raw)
  To: linux-kernel, openib-general

ib_create_ah_from_wc() doesn't create the correct return address (AH)
when there is a GRH present (source & dest GIDs need to be swapped).

Signed-off-by: Ralph Campbell <ralphc@pathscale.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/core/verbs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

4f8448dfe8d3804fadad90c9b77494238b4a4eae
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 4c15e11..c857361 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -107,9 +107,9 @@ struct ib_ah *ib_create_ah_from_wc(struc
 
 	if (wc->wc_flags & IB_WC_GRH) {
 		ah_attr.ah_flags = IB_AH_GRH;
-		ah_attr.grh.dgid = grh->dgid;
+		ah_attr.grh.dgid = grh->sgid;
 
-		ret = ib_find_cached_gid(pd->device, &grh->sgid, &port_num,
+		ret = ib_find_cached_gid(pd->device, &grh->dgid, &port_num,
 					 &gid_index);
 		if (ret)
 			return ERR_PTR(ret);
-- 
0.99.9n

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

end of thread, other threads:[~2006-01-07 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-07 17:07 [git patch review 1/2] IB/uverbs: Release event file reference on ib_uverbs_create_cq() error Roland Dreier
2006-01-07 17:07 ` [git patch review 2/2] IB: Set GIDs correctly in ib_create_ah_from_wc() Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®