All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Return EPROTONOSUPPORT when an RDMA device lacks QP0
@ 2011-05-20 18:19 Weiny, Ira K.
       [not found] ` <E280C3CC-BD50-4383-BE33-FCC31C72D3F0-i2BcT+NCU+M@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Weiny, Ira K. @ 2011-05-20 18:19 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

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.  We have fixed our script.  This patch prevents the panic.



[-- Attachment #2: 0001-Return-EPROTONOSUPPORT-when-an-RDMA-device-lacks-QP0.patch --]
[-- Type: application/octet-stream, Size: 1079 bytes --]

From 82e627f392fc928f55354d0dfc5e7868ac01ead1 Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Date: Thu, 19 May 2011 18:19:28 -0700
Subject: [PATCH] Return EPROTONOSUPPORT when an RDMA device lacks QP0

This prevents a NULL pointer dereference later which panics the kernel.

Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
---
 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 b2dba21..e30652a 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -208,6 +208,13 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
 	u8 mgmt_class, vclass;
 
 	/* Validate parameters */
+	if (qp_type == IB_QPT_SMI &&
+	    rdma_port_get_link_layer(device, port_num)!=
+	    IB_LINK_LAYER_INFINIBAND) {
+		ret = ERR_PTR(-EPROTONOSUPPORT);
+		goto error1;
+	}
+
 	qpn = get_spl_qp_index(qp_type);
 	if (qpn == -1)
 		goto error1;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-05-23 18:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 18:19 [PATCH] Return EPROTONOSUPPORT when an RDMA device lacks QP0 Weiny, Ira K.
     [not found] ` <E280C3CC-BD50-4383-BE33-FCC31C72D3F0-i2BcT+NCU+M@public.gmane.org>
2011-05-20 19:23   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373010745-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-05-20 23:19       ` Weiny, Ira K.
     [not found]         ` <8D19CC19-B4FD-4338-9267-9C1BC32A6BAE-i2BcT+NCU+M@public.gmane.org>
2011-05-20 23:23           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A8237301085B-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-05-20 23:41               ` Weiny, Ira K.
2011-05-23  3:46               ` [PATCH v2] " Weiny, Ira K.
     [not found]                 ` <B4F482DA-6C66-4AC9-A583-D2091E8F32C4-i2BcT+NCU+M@public.gmane.org>
2011-05-23  4:05                   ` Roland Dreier
     [not found]                     ` <BANLkTinoKxr5A6Qm7JXV=7qvgaLwoKJt+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-23  4:45                       ` Weiny, Ira K.
     [not found]                         ` <2F48A0B5-1D6D-4DAC-8192-F4F17DF791B3-i2BcT+NCU+M@public.gmane.org>
2011-05-23 18:14                           ` Roland Dreier
     [not found]                             ` <BANLkTimZSxm_VaBcJtsSG_HD1N2grQ5dPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-23 18:17                               ` Hefty, Sean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.