diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2005-09-26 14:47:53 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-10-17 18:20:24 -0400 |
commit | 0c33aeedb2cf99d877ad9adc7c3df07870f60293 (patch) | |
tree | 7f6b23172b327ebd8b5d4f5d40aa216ba48600a2 /drivers/infiniband | |
parent | 2cc78eb52bc1ae89f0a4fa5a00eb998dffde4a9f (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.c | 18 |
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 | ||
524 | int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) | 524 | int 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 | } |
530 | EXPORT_SYMBOL(ib_attach_mcast); | 533 | EXPORT_SYMBOL(ib_attach_mcast); |
531 | 534 | ||
532 | int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) | 535 | int 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 | } |
538 | EXPORT_SYMBOL(ib_detach_mcast); | 544 | EXPORT_SYMBOL(ib_detach_mcast); |