From: Dennis Dalessandro <dennis.dalessandro@intel.com>
To: dledford@redhat.com
Cc: linux-rdma@vger.kernel.org,
"Michael J. Ruhl" <michael.j.ruhl@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
stable@vger.kernel.org,
Dasaratharaman Chandramouli
<dasaratharaman.chandramouli@intel.com>
Subject: [PATCH v2 03/19] IB/core: For multicast functions, verify that LIDs are multicast LIDs
Date: Fri, 28 Apr 2017 10:39:11 -0700 [thread overview]
Message-ID: <20170428173909.23960.80030.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20170428173443.23960.32602.stgit@scvm10.sc.intel.com>
From: Michael J. Ruhl <michael.j.ruhl@intel.com>
The Infiniband spec defines "A multicast address is defined by a
MGID and a MLID" (section 10.5). Currently the MLID value is not
validated.
Add check to verify that the MLID value is in the correct address
range.
Fixes: 0c33aeedb2cf ("[IB] Add checks to multicast attach and detach")
Cc: stable@vger.kernel.org
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
drivers/infiniband/core/verbs.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 85ed505..207e5c2 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1519,7 +1519,9 @@ 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 < be16_to_cpu(IB_MULTICAST_LID_BASE) ||
+ lid == be16_to_cpu(IB_LID_PERMISSIVE))
return -EINVAL;
ret = qp->device->attach_mcast(qp, gid, lid);
@@ -1535,7 +1537,9 @@ 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 < be16_to_cpu(IB_MULTICAST_LID_BASE) ||
+ lid == be16_to_cpu(IB_LID_PERMISSIVE))
return -EINVAL;
ret = qp->device->detach_mcast(qp, gid, lid);
next prev parent reply other threads:[~2017-04-28 17:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 17:38 [PATCH v2 00/19] IB/hfi1,rdmavt,core: Patches for-next Dennis Dalessandro
2017-04-28 17:39 ` Dennis Dalessandro [this message]
[not found] ` <20170428173443.23960.32602.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-04-28 17:38 ` [PATCH v2 01/19] IB/core: If the MGID/MLID pair is not on the list return an error Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 02/19] IB/hfi1: Correct MulticastMask/CollectiveMask info to SMA output Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 04/19] IB/rdmavt/hfi1/qib: Use the MGID and MLID for multicast addressing Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 05/19] IB/hfi1: Validate the TID count before using it Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 06/19] IB/hfi1: Return SC2VL mappings to FM with VL15 instead of ILLEGAL_VL Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 07/19] IB/hfi1: Rename hdr2sc to hfi1_9B_get_sc5 Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 08/19] IB/hfi1: Add functions to parse 9B headers Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 09/19] IB/hfi1: Use defines from common headers Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 10/19] IB/hfi1: Prevent kernel QP post send hard lockups Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 11/19] IB/hfi1: Fix softlockup issue Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 12/19] IB/hfi1: Adjust high temperature warning for QSFP cable Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 13/19] IB/hfi1: Cache neighbor secure data after link up Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 14/19] IB/hfi1: Permanently enable P_Key checking in HFI Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 15/19] IB/hfi1: Fix misspelling in comment Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 16/19] IB/hfi1: Convert %Lx to %llx Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 17/19] IB/hfi1: Fix unbalanced braces around else Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 18/19] IB/hfi: Protect against writable mmap Dennis Dalessandro
2017-04-28 17:40 ` [PATCH v2 19/19] IB/hfi1: Use bool in process_ecn Dennis Dalessandro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170428173909.23960.80030.stgit@scvm10.sc.intel.com \
--to=dennis.dalessandro@intel.com \
--cc=dasaratharaman.chandramouli@intel.com \
--cc=dledford@redhat.com \
--cc=ira.weiny@intel.com \
--cc=linux-rdma@vger.kernel.org \
--cc=michael.j.ruhl@intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).