Skip to content

Commit

Permalink
[IB] Add checks to multicast attach and detach
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Oct 17, 2005
1 parent 2cc78eb commit 0c33aee
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/infiniband/core/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,16 +523,22 @@ EXPORT_SYMBOL(ib_dealloc_fmr);

int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
{
return qp->device->attach_mcast ?
qp->device->attach_mcast(qp, gid, lid) :
-ENOSYS;
if (!qp->device->attach_mcast)
return -ENOSYS;
if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
return -EINVAL;

return qp->device->attach_mcast(qp, gid, lid);
}
EXPORT_SYMBOL(ib_attach_mcast);

int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
{
return qp->device->detach_mcast ?
qp->device->detach_mcast(qp, gid, lid) :
-ENOSYS;
if (!qp->device->detach_mcast)
return -ENOSYS;
if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
return -EINVAL;

return qp->device->detach_mcast(qp, gid, lid);
}
EXPORT_SYMBOL(ib_detach_mcast);

0 comments on commit 0c33aee

Please sign in to comment.