[PATCH 4.19 195/321] net/wan/fsl_ucc_hdlc: Avoid double free in ucc_hdlc_probe()

From: Greg Kroah-Hartman
Date: Tue Dec 03 2019 - 18:03:03 EST


From: Wen Yang <wen.yang99@xxxxxxxxxx>

[ Upstream commit 40752b3eae29f8ca2378e978a02bd6dbeeb06d16 ]

This patch fixes potential double frees if register_hdlc_device() fails.

Signed-off-by: Wen Yang <wen.yang99@xxxxxxxxxx>
Reviewed-by: Peng Hao <peng.hao2@xxxxxxxxxx>
CC: Zhao Qiang <qiang.zhao@xxxxxxx>
CC: "David S. Miller" <davem@xxxxxxxxxxxxx>
CC: netdev@xxxxxxxxxxxxxxx
CC: linuxppc-dev@xxxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/net/wan/fsl_ucc_hdlc.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
index 5f0366a125e26..0212f576a838c 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -1113,7 +1113,6 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
if (register_hdlc_device(dev)) {
ret = -ENOBUFS;
pr_err("ucc_hdlc: unable to register hdlc device\n");
- free_netdev(dev);
goto free_dev;
}

--
2.20.1