USB: ehci-platform: fix companion-device leak
authorJohan Hovold <johan@kernel.org>
Tue, 16 May 2017 14:26:13 +0000 (16:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2017 09:52:44 +0000 (11:52 +0200)
Make sure do drop the reference taken to the companion device during
resume.

Fixes: d4d75128b8fd ("usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume")
Cc: stable <stable@vger.kernel.org> # 4.11
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-platform.c

index bc7b9be12f540cb22dc3a5e9ab93aa49f4c722ef..f1908ea9fbd863f9d693d6a852e154e72087770c 100644 (file)
@@ -384,8 +384,10 @@ static int ehci_platform_resume(struct device *dev)
        }
 
        companion_dev = usb_of_get_companion_dev(hcd->self.controller);
-       if (companion_dev)
+       if (companion_dev) {
                device_pm_wait_for_dev(hcd->self.controller, companion_dev);
+               put_device(companion_dev);
+       }
 
        ehci_resume(hcd, priv->reset_on_resume);
        return 0;