Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bb6e0cc authored by Pan Bian's avatar Pan Bian Committed by Greg Kroah-Hartman
Browse files

net: hisilicon: remove unexpected free_netdev



[ Upstream commit c758940158bf29fe14e9d0f89d5848f227b48134 ]

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>
parent 992963c6
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -922,10 +922,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;