diff options
author | Pan Bian <bianpan2016@163.com> | 2018-11-28 08:30:24 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-28 19:41:15 +0100 |
commit | c758940158bf29fe14e9d0f89d5848f227b48134 (patch) | |
tree | fd0e70a0fbe5f1b8d0522b921deb3fe197574616 /drivers/net/ethernet | |
parent | rapidio/rionet: do not free skb before reading its length (diff) | |
download | linux-c758940158bf29fe14e9d0f89d5848f227b48134.tar.xz linux-c758940158bf29fe14e9d0f89d5848f227b48134.zip |
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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hip04_eth.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c index be268dcde8fa..f9a4e76c5a8b 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -915,10 +915,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; |