Skip to contentSkip to conversation

Patch "mdio-sun4i: Fix a memory leak" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Feb 28, 2018

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

mdio-sun4i: Fix a memory leak

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mdio-sun4i-fix-a-memory-leak.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Feb 28 16:23:28 CET 2018

From: Christophe JAILLET <[email protected]>
Date: Sat, 6 Jan 2018 09:00:09 +0100
Subject: mdio-sun4i: Fix a memory leak

From: Christophe JAILLET <[email protected]>

[ Upstream commit 56c0290202ab94a2f2780c449395d4ae8495fab4 ]

If the probing of the regulator is deferred, the memory allocated by 'mdiobus_alloc_size()' will be leaking.
It should be freed before the next call to 'sun4i_mdio_probe()' which will reallocate it.

Fixes 4bdcb1dd9feb ("net: Add MDIO bus driver for the Allwinner EMAC")
---
 drivers/net/phy/mdio-sun4i.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/phy/mdio-sun4i.c +4 -2
@@ -118,8 +118,10 @@ static int sun4i_mdio_probe(struct platf
 
 	data->regulator = devm_regulator_get(&pdev->dev, "phy");
 	if (IS_ERR(data->regulator)) {
-		if (PTR_ERR(data->regulator) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
+		if (PTR_ERR(data->regulator) == -EPROBE_DEFER) {
+			ret = -EPROBE_DEFER;
+			goto err_out_free_mdiobus;
+		}
 
 		dev_info(&pdev->dev, "no regulator found\n");
 		data->regulator = NULL;

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/mdio-sun4i-fix-a-memory-leak.patch queue-4.14/mm-frame_vector.c-release-a-semaphore-in-get_vaddr_frames.patch