From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rob Herring" <robh+dt@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Peter Chen" <peter.chen@nxp.com>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, "Johan Hovold" <johan@kernel.org>,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH 7/8] USB: ledtrig-usbport: fix of-node leak
Date: Thu, 9 Nov 2017 18:07:22 +0100 [thread overview]
Message-ID: <20171109170723.10960-8-johan@kernel.org> (raw)
In-Reply-To: <20171109170723.10960-1-johan@kernel.org>
This code looks up a USB device node from a given parent USB device but
never dropped its reference to the returned node.
As only the address of the node is used for a later matching, the
reference can be dropped immediately.
Note that this trigger implementation confuses the description of the
USB device connected to a port with the port itself (which does not have
a device-tree representation).
Fixes: 4f04c210d031 ("usb: core: read USB ports from DT in the usbport LED trigger driver")
Cc: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/core/ledtrig-usbport.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c
index 9dbb429cd471..f1fde5165068 100644
--- a/drivers/usb/core/ledtrig-usbport.c
+++ b/drivers/usb/core/ledtrig-usbport.c
@@ -137,11 +137,17 @@ static bool usbport_trig_port_observed(struct usbport_trig_data *usbport_data,
if (!led_np)
return false;
- /* Get node of port being added */
+ /*
+ * Get node of port being added
+ *
+ * FIXME: This is really the device node of the connected device
+ */
port_np = usb_of_get_child_node(usb_dev->dev.of_node, port1);
if (!port_np)
return false;
+ of_node_put(port_np);
+
/* Amount of trigger sources for this LED */
count = of_count_phandle_with_args(led_np, "trigger-sources",
"#trigger-source-cells");
--
2.15.0
next prev parent reply other threads:[~2017-11-09 17:07 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 17:07 [PATCH 0/8] USB: add device-tree support for interfaces Johan Hovold
2017-11-09 17:07 ` [PATCH 1/8] dt-bindings: usb: fix example hub node name Johan Hovold
2017-11-15 15:44 ` Rob Herring
2017-11-09 17:07 ` [PATCH 2/8] dt-bindings: usb: fix reg-property port-number range Johan Hovold
2017-11-09 17:07 ` [PATCH 4/8] dt-bindings: usb: document hub and host-controller properties Johan Hovold
[not found] ` <20171109170723.10960-5-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-15 15:46 ` Rob Herring
2017-11-15 15:46 ` Rob Herring
2017-11-16 8:45 ` Johan Hovold
2017-11-16 8:45 ` Johan Hovold
2017-11-16 14:32 ` Rob Herring
2017-11-16 14:32 ` Rob Herring
2017-11-09 17:07 ` [PATCH 5/8] dt-bindings: usb: add interface binding Johan Hovold
2017-11-09 17:07 ` [PATCH 6/8] USB: add device-tree support for interfaces Johan Hovold
2017-11-09 17:07 ` Johan Hovold [this message]
2017-11-09 17:07 ` [PATCH 8/8] USB: of: clean up device-node helper Johan Hovold
[not found] ` <20171109170723.10960-1-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-09 17:07 ` [PATCH 3/8] dt-bindings: usb: clean up compatible property Johan Hovold
2017-11-09 17:07 ` Johan Hovold
2017-11-16 14:43 ` [PATCH 0/8] USB: add device-tree support for interfaces Rob Herring
2017-11-16 14:43 ` Rob Herring
2017-11-16 16:12 ` Johan Hovold
2017-11-16 16:12 ` Johan Hovold
2017-11-16 18:33 ` Rob Herring
2017-11-16 18:33 ` Rob Herring
[not found] ` <CAL_JsqKFpa6_0nB5ftgFRvwqMN8aBGymASZY7ZeykN0MD6UWbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-17 16:30 ` Johan Hovold
2017-11-17 16:30 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171109170723.10960-8-johan@kernel.org \
--to=johan@kernel.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peter.chen@nxp.com \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.