[ofa-general] [PATCH] core/verbs: Check that the LID in attach/detach multicast group is a multicast LID

Dotan Barak dotanb at dev.mellanox.co.il
Thu Aug 16 07:14:34 PDT 2007


Check that the LID in attach/detach multicast group is a multicast LID.

Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>

---

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 86ed8af..97353ff 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -832,7 +832,8 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
 {
 	if (!qp->device->attach_mcast)
 		return -ENOSYS;
-	if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
+	if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD ||
+	    lid < 0xc000 || lid > 0xfffe)
 		return -EINVAL;
 
 	return qp->device->attach_mcast(qp, gid, lid);
@@ -843,7 +844,8 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
 {
 	if (!qp->device->detach_mcast)
 		return -ENOSYS;
-	if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
+	if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD ||
+	    lid < 0xc000 || lid > 0xfffe)
 		return -EINVAL;
 
 	return qp->device->detach_mcast(qp, gid, lid);



More information about the general mailing list