提交 ca6de177 编写于 作者: E Eli Cohen 提交者: Roland Dreier

IPoIB: Fix error path memory leak

Clean up properly if ib_query_pkey() or ib_query_gid() fail.
Signed-off-by: NEli Cohen <eli@mellanox.co.il>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 b3ac60fc
...@@ -1083,7 +1083,7 @@ static struct net_device *ipoib_add_port(const char *format, ...@@ -1083,7 +1083,7 @@ static struct net_device *ipoib_add_port(const char *format,
if (result) { if (result) {
printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n", printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
hca->name, port, result); hca->name, port, result);
goto alloc_mem_failed; goto device_init_failed;
} }
/* /*
...@@ -1099,7 +1099,7 @@ static struct net_device *ipoib_add_port(const char *format, ...@@ -1099,7 +1099,7 @@ static struct net_device *ipoib_add_port(const char *format,
if (result) { if (result) {
printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n", printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n",
hca->name, port, result); hca->name, port, result);
goto alloc_mem_failed; goto device_init_failed;
} else } else
memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册