Skip to content

Commit

Permalink
RDMA/cxgb3: Handle NULL inetdev pointer in iwch_query_port()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
  • Loading branch information
Steve Wise authored and Roland Dreier committed Oct 7, 2009
1 parent 0eca52a commit e5da4ed
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/infiniband/hw/cxgb3/iwch_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit e5da4ed

Please sign in to comment.