Subject: [PATCH AUTOSEL 4.14 090/127] net/wan/fsl_ucc_hdlc: Avoid double free in ucc_hdlc_probe()

From: Sasha Levin <[email-masked]>
Date: Fri, 22 Nov 2019 00:55:08 -0500

From: Wen Yang <[email-masked]>

[ Upstream commit 40752b3eae29f8ca2378e978a02bd6dbeeb06d16 ]

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

Signed-off-by: Wen Yang <[email-masked]>
Reviewed-by: Peng Hao <[email-masked]>
CC: Zhao Qiang <[email-masked]>
CC: "David S. Miller" <[email-masked]>
CC: [email-masked]
CC: [email-masked]
CC: [email-masked]
Signed-off-by: David S. Miller <[email-masked]>
Signed-off-by: Sasha Levin <[email-masked]>
---
 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 18b648648adb2..289dff262948d 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -1114,7 +1114,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