Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1581853 > unrolled thread

[PATCH 3.16 246/306] of_mdio: fix node leak in of_phy_register_fixed_link error path

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-02-16 00:20 +0100
Last post2017-02-16 00:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 246/306] of_mdio: fix node leak in of_phy_register_fixed_link  error path Ben Hutchings <ben@decadent.org.uk> - 2017-02-16 00:20 +0100

#1581853 — [PATCH 3.16 246/306] of_mdio: fix node leak in of_phy_register_fixed_link error path

FromBen Hutchings <ben@decadent.org.uk>
Date2017-02-16 00:20 +0100
Subject[PATCH 3.16 246/306] of_mdio: fix node leak in of_phy_register_fixed_link error path
Message-ID<tbh1G-6nD-77@gated-at.bofh.it>
3.16.40-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 48c1699d5335bc045b50989a06b1c526b17a25ff upstream.

Make sure to drop the of_node reference also on failure to parse the
speed property in of_phy_register_fixed_link().

Fixes: 3be2a49e5c08 ("of: provide a binding for fixed link PHYs")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/of/of_mdio.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -291,8 +291,11 @@ int of_phy_register_fixed_link(struct de
 		status.link = 1;
 		status.duplex = of_property_read_bool(fixed_link_node,
 						      "full-duplex");
-		if (of_property_read_u32(fixed_link_node, "speed", &status.speed))
+		if (of_property_read_u32(fixed_link_node, "speed",
+					 &status.speed)) {
+			of_node_put(fixed_link_node);
 			return -EINVAL;
+		}
 		status.pause = of_property_read_bool(fixed_link_node, "pause");
 		status.asym_pause = of_property_read_bool(fixed_link_node,
 							  "asym-pause");

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web