diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/mad.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 822cfdcd9f78..b4d8672a3e4e 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, | |||
276 | goto error1; | 276 | goto error1; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* Verify the QP requested is supported. For example, Ethernet devices | ||
280 | * will not have QP0 */ | ||
281 | if (!port_priv->qp_info[qpn].qp) { | ||
282 | ret = ERR_PTR(-EPROTONOSUPPORT); | ||
283 | goto error1; | ||
284 | } | ||
285 | |||
279 | /* Allocate structures */ | 286 | /* Allocate structures */ |
280 | mad_agent_priv = kzalloc(sizeof *mad_agent_priv, GFP_KERNEL); | 287 | mad_agent_priv = kzalloc(sizeof *mad_agent_priv, GFP_KERNEL); |
281 | if (!mad_agent_priv) { | 288 | if (!mad_agent_priv) { |