summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/mad.c
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2015-06-06 14:38:29 -0400
committerDoug Ledford <dledford@redhat.com>2015-06-12 14:49:17 -0400
commit337877a466bb8b0c51f4fa727eeef7d734665632 (patch)
tree3d05512e358f2fe92e15db23a2b7bc18312f116b /drivers/infiniband/core/mad.c
parentda2dfaa3a35cb5b68fc6ab2e442339de03cacd09 (diff)
downloadlinux-stable-337877a466bb8b0c51f4fa727eeef7d734665632.tar.gz
linux-stable-337877a466bb8b0c51f4fa727eeef7d734665632.tar.bz2
linux-stable-337877a466bb8b0c51f4fa727eeef7d734665632.zip
IB/core: Add ability for drivers to report an alternate MAD size.
Add max MAD size to the device immutable data set and have all drivers that support MADs report the current IB MAD size (IB_MGMT_MAD_SIZE) to the core. Verify MAD size data in both the MAD core and when reading the immutable data. OPA drivers will report alternate MAD sizes in subsequent patches. Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/mad.c')
-rw-r--r--drivers/infiniband/core/mad.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index b6d56e97bbaf..c3452fc54e88 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2939,6 +2939,9 @@ static int ib_mad_port_open(struct ib_device *device,
int has_smi;
struct ib_cq_init_attr cq_attr = {};
+ if (WARN_ON(rdma_max_mad_size(device, port_num) < IB_MGMT_MAD_SIZE))
+ return -EFAULT;
+
/* Create new device info */
port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
if (!port_priv) {