lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 24 Nov 2020 23:52:37 +0100
From:   Pavel Machek <pavel@....cz>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Zhang Qilong <zhangqilong3@...wei.com>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 51/91] can: ti_hecc: Fix memleak in ti_hecc_probe

Hi!

> From: Zhang Qilong <zhangqilong3@...wei.com>
> 
> [ Upstream commit 7968c7c79d3be8987feb8021f0c46e6866831408 ]
> 
> In the error handling, we should goto the probe_exit_candev
> to free ndev to prevent memory leak.

Well, that's true.

Unfortunately, 4.19 version has way more exit paths than mainline, so
the fix is not nearly complete. Mainline code is fragile but okay.

> Fixes: dabf54dd1c63 ("can: ti_hecc: Convert TI HECC driver to DT  only driver")

I'm pretty sure problems were there before this commit.

Signed-off-by: Pavel Machek (CIP) <pavel@...x.de>

Best regards,
								Pavel

diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 81a3fdd5e010..4400a1a7dbd0 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -897,7 +897,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hecc");
 	if (!res) {
 		dev_err(&pdev->dev, "can't get IORESOURCE_MEM hecc\n");
-		return -EINVAL;
+		err = -EINVAL;
+		goto probe_exit_candev;
 	}
 
 	priv->base = devm_ioremap_resource(&pdev->dev, res);
@@ -911,7 +912,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hecc-ram");
 	if (!res) {
 		dev_err(&pdev->dev, "can't get IORESOURCE_MEM hecc-ram\n");
-		return -EINVAL;
+		err = -EINVAL;
+		goto probe_exit_candev;
 	}
 
 	priv->hecc_ram = devm_ioremap_resource(&pdev->dev, res);
@@ -925,7 +927,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbx");
 	if (!res) {
 		dev_err(&pdev->dev, "can't get IORESOURCE_MEM mbx\n");
-		return -EINVAL;
+		err = -EINVAL;
+		goto probe_exit_candev;
 	}
 
 	priv->mbx = devm_ioremap_resource(&pdev->dev, res);


-- 
http://www.livejournal.com/~pavelmachek

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ