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>
This commit is contained in:
parent
0eca52a927
commit
e5da4ed8a4
|
@ -1199,11 +1199,14 @@ static int iwch_query_port(struct ib_device *ibdev,
|
||||||
props->state = IB_PORT_DOWN;
|
props->state = IB_PORT_DOWN;
|
||||||
else {
|
else {
|
||||||
inetdev = in_dev_get(netdev);
|
inetdev = in_dev_get(netdev);
|
||||||
if (inetdev->ifa_list)
|
if (inetdev) {
|
||||||
props->state = IB_PORT_ACTIVE;
|
if (inetdev->ifa_list)
|
||||||
else
|
props->state = IB_PORT_ACTIVE;
|
||||||
|
else
|
||||||
|
props->state = IB_PORT_INIT;
|
||||||
|
in_dev_put(inetdev);
|
||||||
|
} else
|
||||||
props->state = IB_PORT_INIT;
|
props->state = IB_PORT_INIT;
|
||||||
in_dev_put(inetdev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
props->port_cap_flags =
|
props->port_cap_flags =
|
||||||
|
|
Loading…
Reference in a new issue