aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@mellanox.co.il>2005-09-26 14:47:53 -0400
committerRoland Dreier <rolandd@cisco.com>2005-10-17 18:20:24 -0400
commit0c33aeedb2cf99d877ad9adc7c3df07870f60293 (patch)
tree7f6b23172b327ebd8b5d4f5d40aa216ba48600a2 /drivers/infiniband
parent2cc78eb52bc1ae89f0a4fa5a00eb998dffde4a9f (diff)
[IB] Add checks to multicast attach and detach
Add checks so that we only allow multicast attach/detach with a valid multicast GID and the correct QP type. Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/verbs.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 5081d903e561..72d3ef786db5 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -523,16 +523,22 @@ EXPORT_SYMBOL(ib_dealloc_fmr);
523 523
524int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) 524int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
525{ 525{
526 return qp->device->attach_mcast ? 526 if (!qp->device->attach_mcast)
527 qp->device->attach_mcast(qp, gid, lid) : 527 return -ENOSYS;
528 -ENOSYS; 528 if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
529 return -EINVAL;
530
531 return qp->device->attach_mcast(qp, gid, lid);
529} 532}
530EXPORT_SYMBOL(ib_attach_mcast); 533EXPORT_SYMBOL(ib_attach_mcast);
531 534
532int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) 535int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
533{ 536{
534 return qp->device->detach_mcast ? 537 if (!qp->device->detach_mcast)
535 qp->device->detach_mcast(qp, gid, lid) : 538 return -ENOSYS;
536 -ENOSYS; 539 if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
540 return -EINVAL;
541
542 return qp->device->detach_mcast(qp, gid, lid);
537} 543}
538EXPORT_SYMBOL(ib_detach_mcast); 544EXPORT_SYMBOL(ib_detach_mcast);