Skip to contentSkip to conversation

net: hisilicon: remove unexpected free_netdev

PATCH Applied Pan Bian 2 participants 2 messages Nov 28, 2018

Subsystems (3)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hip04_eth.c +1 -3
index be268dc..f9a4e76 100644
@@ -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;
 
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

From: Pan Bian <[email protected]>
Date: Wed, 28 Nov 2018 15:30:24 +0800

Quoted 5 lines

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.

Applied.