aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorIra Weiny <weiny2@llnl.gov>2011-05-19 18:19:28 -0700
committerRoland Dreier <roland@purestorage.com>2011-05-23 11:15:48 -0700
commitc8367c4cd9de512d296fc557f121be62a43987f3 (patch)
tree36b9c185a8ebda7dfbe1a61884291f6ae04766d8 /drivers/infiniband
parent257313b2a87795e07a0bdf58d0fffbdba8b31051 (diff)
downloadkernel_samsung_smdk4412-c8367c4cd9de512d296fc557f121be62a43987f3.zip
kernel_samsung_smdk4412-c8367c4cd9de512d296fc557f121be62a43987f3.tar.gz
kernel_samsung_smdk4412-c8367c4cd9de512d296fc557f121be62a43987f3.tar.bz2
IB/mad: Return EPROTONOSUPPORT when an RDMA device lacks the QP required
We had a script which was looping through the devices returned from ibstat and attempted to register a SMI agent on an ethernet device. This caused a kernel panic for IBoE devices that don't have QP0. Fix this by checking if the QP exists before using it. Signed-off-by: Ira Weiny <weiny2@llnl.gov> Acked-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/mad.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 822cfdc..b4d8672 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -276,6 +276,13 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
goto error1;
}
+ /* Verify the QP requested is supported. For example, Ethernet devices
+ * will not have QP0 */
+ if (!port_priv->qp_info[qpn].qp) {
+ ret = ERR_PTR(-EPROTONOSUPPORT);
+ goto error1;
+ }
+
/* Allocate structures */
mad_agent_priv = kzalloc(sizeof *mad_agent_priv, GFP_KERNEL);
if (!mad_agent_priv) {