提交 dcb37ac0 编写于 作者: H Haiyang Zhang 提交者: Xie XiuQi

hv_netvsc: Fix error handling in netvsc_attach()

[ Upstream commit 719b85c336ed35565d0f3982269d6f684087bb00 ]

If rndis_filter_open() fails, we need to remove the rndis device created
in earlier steps, before returning an error code. Otherwise, the retry of
netvsc_attach() from its callers will fail and hang.

Fixes: 7b2ee50c ("hv_netvsc: common detach logic")
Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 712cf09a
...@@ -993,7 +993,7 @@ static int netvsc_attach(struct net_device *ndev, ...@@ -993,7 +993,7 @@ static int netvsc_attach(struct net_device *ndev,
if (netif_running(ndev)) { if (netif_running(ndev)) {
ret = rndis_filter_open(nvdev); ret = rndis_filter_open(nvdev);
if (ret) if (ret)
return ret; goto err;
rdev = nvdev->extension; rdev = nvdev->extension;
if (!rdev->link_state) if (!rdev->link_state)
...@@ -1001,6 +1001,13 @@ static int netvsc_attach(struct net_device *ndev, ...@@ -1001,6 +1001,13 @@ static int netvsc_attach(struct net_device *ndev,
} }
return 0; return 0;
err:
netif_device_detach(ndev);
rndis_filter_device_remove(hdev, nvdev);
return ret;
} }
static int netvsc_set_channels(struct net_device *net, static int netvsc_set_channels(struct net_device *net,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册