Commit 0c33aeed authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Roland Dreier

[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: default avatarJack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 2cc78eb5
...@@ -523,16 +523,22 @@ EXPORT_SYMBOL(ib_dealloc_fmr); ...@@ -523,16 +523,22 @@ EXPORT_SYMBOL(ib_dealloc_fmr);
int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
{ {
return qp->device->attach_mcast ? if (!qp->device->attach_mcast)
qp->device->attach_mcast(qp, gid, lid) : return -ENOSYS;
-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); EXPORT_SYMBOL(ib_attach_mcast);
int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
{ {
return qp->device->detach_mcast ? if (!qp->device->detach_mcast)
qp->device->detach_mcast(qp, gid, lid) : return -ENOSYS;
-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); EXPORT_SYMBOL(ib_detach_mcast);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment