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


Groups > linux.kernel > #1568245 > unrolled thread

[PATCH 3.12 113/235] USB: phy: am335x-control: fix device and of_node leaks

Started byJiri Slaby <jslaby@suse.cz>
First post2017-01-27 12:50 +0100
Last post2017-01-27 12:50 +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.12 113/235] USB: phy: am335x-control: fix device and of_node leaks Jiri Slaby <jslaby@suse.cz> - 2017-01-27 12:50 +0100

#1568245 — [PATCH 3.12 113/235] USB: phy: am335x-control: fix device and of_node leaks

FromJiri Slaby <jslaby@suse.cz>
Date2017-01-27 12:50 +0100
Subject[PATCH 3.12 113/235] USB: phy: am335x-control: fix device and of_node leaks
Message-ID<t4dcv-3zE-41@gated-at.bofh.it>
From: Johan Hovold <johan@kernel.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 015105b12183556771e111e93f5266851e7c5582 upstream.

Make sure to drop the references taken by of_parse_phandle() and
bus_find_device() before returning from am335x_get_phy_control().

Note that there is no guarantee that the devres-managed struct
phy_control will be valid for the lifetime of the sibling phy device
regardless of this change.

Fixes: 3bb869c8b3f1 ("usb: phy: Add AM335x PHY driver")
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/phy/phy-am335x-control.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c
index 22cf07d62e4c..0b8efff8524c 100644
--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -85,7 +85,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev)
 		return NULL;
 
 	dev = bus_find_device(&platform_bus_type, NULL, node, match);
+	of_node_put(node);
 	ctrl_usb = dev_get_drvdata(dev);
+	put_device(dev);
 	if (!ctrl_usb)
 		return NULL;
 	return &ctrl_usb->phy_ctrl;
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web