提交 58e9cc90 编写于 作者: A Amir Vadai 提交者: Doug Ledford

IB/IPoIB: Fix bad error flow in ipoib_add_port()

Error values of ib_query_port() and ib_query_device() weren't propagated
correctly. Because of that, ipoib_add_port() could return NULL value,
which escaped the IS_ERR() check in ipoib_add_one() and we crashed.
Signed-off-by: NAmir Vadai <amirv@mellanox.com>
Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: NIra Weiny <ira.weiny@intel.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 8a7ff14d
......@@ -1577,7 +1577,8 @@ static struct net_device *ipoib_add_port(const char *format,
SET_NETDEV_DEV(priv->dev, hca->dma_device);
priv->dev->dev_id = port - 1;
if (!ib_query_port(hca, port, &attr))
result = ib_query_port(hca, port, &attr);
if (!result)
priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);
else {
printk(KERN_WARNING "%s: ib_query_port %d failed\n",
......@@ -1598,7 +1599,8 @@ static struct net_device *ipoib_add_port(const char *format,
goto device_init_failed;
}
if (ipoib_set_dev_features(priv, hca))
result = ipoib_set_dev_features(priv, hca);
if (result)
goto device_init_failed;
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册