aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2009-10-07 18:51:07 -0400
committerRoland Dreier <rolandd@cisco.com>2009-10-07 18:51:07 -0400
commite5da4ed8a486113a4b0e587a0c7843e4a9c08aac (patch)
tree04114a95a06a75bc34274ffeeb0007be487e8027 /drivers
parent0eca52a92735f43462165efe00a7e394345fb38e (diff)
RDMA/cxgb3: Handle NULL inetdev pointer in iwch_query_port()
in_dev_get() can return NULL. If it does, iwch_query_port() will crash. Handle the NULL case by mapping it to port state INIT. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 6895523779d0..03cfaecc3bb7 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1199,11 +1199,14 @@ static int iwch_query_port(struct ib_device *ibdev,
1199 props->state = IB_PORT_DOWN; 1199 props->state = IB_PORT_DOWN;
1200 else { 1200 else {
1201 inetdev = in_dev_get(netdev); 1201 inetdev = in_dev_get(netdev);
1202 if (inetdev->ifa_list) 1202 if (inetdev) {
1203 props->state = IB_PORT_ACTIVE; 1203 if (inetdev->ifa_list)
1204 else 1204 props->state = IB_PORT_ACTIVE;
1205 else
1206 props->state = IB_PORT_INIT;
1207 in_dev_put(inetdev);
1208 } else
1205 props->state = IB_PORT_INIT; 1209 props->state = IB_PORT_INIT;
1206 in_dev_put(inetdev);
1207 } 1210 }
1208 1211
1209 props->port_cap_flags = 1212 props->port_cap_flags =