[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <890e3e7329b020356206262e9c3ee57378648e1c.1659506415.git.christophe.jaillet@wanadoo.fr>
Date: Wed, 3 Aug 2022 08:00:44 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Russell King <linux@...linux.org.uk>,
Sascha Hauer <s.hauer@...gutronix.de>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Marek Vasut <marek.vasut@...il.com>,
Igor Grinberg <grinberg@...pulab.co.il>,
Felipe Balbi <balbi@...com>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH] ARM: pxa: Fix a memory leak in pxa310_otg_exit()
When otg_ulpi_create() is called, 2 kzalloc() are performed.
Only one is freed in pxa310_otg_exit().
The second kzalloc() has been introduced in the commit in the Fixes: tag.
Add the missing kfree().
Fixes: 298b083cf9dd ("usb: otg: ulpi: Start using struct usb_otg")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
This patch is NOT compile tested (I never cross compile even if I've been
tolled many times that it was easy...)
Another solution is to use devm_otg_ulpi_create() and further simplify
arch/arm/mach-pxa/pxa3xx-ulpi.c.
This would remove the only caller of otg_ulpi_create() and could also
simplify drivers/usb/phy/phy-ulpi.[ch]
---
arch/arm/mach-pxa/pxa3xx-ulpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index c29a7f0fa1b0..82b4e2706f86 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -229,6 +229,7 @@ static int pxa310_otg_init(struct pxa3xx_u2d_platform_data *pdata)
static void pxa310_otg_exit(void)
{
+ kfree(u2d->otg->otg);
kfree(u2d->otg);
}
#else
--
2.34.1
Powered by blists - more mailing lists