forked from Minki/linux
net: hisilicon: remove unexpected free_netdev
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: Pan Bian <bianpan2016@163.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cfc435198f
commit
c758940158
@ -915,10 +915,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = register_netdev(ndev);
|
ret = register_netdev(ndev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
free_netdev(ndev);
|
|
||||||
goto alloc_fail;
|
goto alloc_fail;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user