Commit 85ff62ea authored by Pan Bian's avatar Pan Bian Committed by Juerg Haefliger

net: hisilicon: remove unexpected free_netdev

BugLink: https://bugs.launchpad.net/bugs/1811080

[ Upstream commit c7589401 ]

The net device ndev is freed via free_netdev when failing to register
the device. The control flow then jumps to the error handling code
block. ndev is used and freed again. Resulting in a use-after-free bug.
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 4605540e
......@@ -919,10 +919,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
}
ret = register_netdev(ndev);
if (ret) {
free_netdev(ndev);
if (ret)
goto alloc_fail;
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment