Skip to contentSkip to conversation

RDMA/cxgb3: iwch_query_port() - handle null inetdev ptr.

PATCH In review Steve Wise 2 participants 2 messages Oct 6, 2009 – Oct 7, 2009 1 message not in the archive InfiniBand

lore
Share & tools
lore

Steve Wise

author
#0 lore raw

PATCH 1/1 RDMA/cxgb3: iwch_query_port() - handle null inetdev ptr.

in_dev_get() can return NULL. If it does, iwch_query_port() will crash. Handle the NULL case by mapping it to rdma state INIT.

---

 drivers/infiniband/hw/cxgb3/iwch_provider.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_provider.c +7 -4
index 6895523..03cfaec 100644
@@ -1199,11 +1199,14 @@ static int iwch_query_port(struct ib_device *ibdev,
 		props->state = IB_PORT_DOWN;
 	else {
 		inetdev = in_dev_get(netdev);
-		if (inetdev->ifa_list)
-			props->state = IB_PORT_ACTIVE;
-		else
+		if (inetdev) {
+			if (inetdev->ifa_list)
+				props->state = IB_PORT_ACTIVE;
+			else
+				props->state = IB_PORT_INIT;
+			in_dev_put(inetdev);
+		} else
 			props->state = IB_PORT_INIT;
-		in_dev_put(inetdev);
 	}
 
 	props->port_cap_flags =

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20091006211321.16751.15175.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org