net/wan/fsl_ucc_hdlc: Avoid double free in ucc_hdlc_probe()
authorWen Yang <wen.yang99@zte.com.cn>
Wed, 26 Dec 2018 08:28:30 +0000 (16:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:37:51 +0000 (15:37 +0100)
[ Upstream commit 40752b3eae29f8ca2378e978a02bd6dbeeb06d16 ]

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

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Peng Hao <peng.hao2@zte.com.cn>
CC: Zhao Qiang <qiang.zhao@nxp.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
CC: linuxppc-dev@lists.ozlabs.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wan/fsl_ucc_hdlc.c

index 18b648648adb2e5676fadf3fc66721e7f84ac972..289dff262948df9cce1d7a723e3c83b6a3e3d71e 100644 (file)
@@ -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;
        }