mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] mfd: core: Fix memory leak of 'cell'
@ 2020-07-16 14:28 Lee Jones
       [not found] ` <CGME20200805142610eucas1p1dd85e87d57dab1433d3d31a9c0ec49d6@eucas1p1.samsung.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Jones @ 2020-07-16 14:28 UTC (permalink / raw)
  To: lee.jones; +Cc: linux-arm-kernel, linux-kernel

When creating a platform device from an MFD cell description, we
allocate some memory and make a copy which is then stored inside the
platform_device's structure.  However, care is not currently taken to
free the allocated memory when the platform device is torn down.

This patch takes care of the leak.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/mfd-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index f5a73af60dd40..e831e733b38cf 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -297,7 +297,10 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)
 	regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies,
 					       cell->num_parent_supplies);
 
+	kfree(cell);
+
 	platform_device_unregister(pdev);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-13  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 14:28 [PATCH 1/1] mfd: core: Fix memory leak of 'cell' Lee Jones
     [not found] ` <CGME20200805142610eucas1p1dd85e87d57dab1433d3d31a9c0ec49d6@eucas1p1.samsung.com>
2020-08-05 14:26   ` Marek Szyprowski
     [not found]     ` <CGME20200813072409eucas1p1dd94af95802a53a5b5f2991cd535d843@eucas1p1.samsung.com>
2020-08-13  7:24       ` Marek Szyprowski
2020-08-13  8:01         ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®