Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-12 22:18:26 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-12 22:21:23 +0100
commit2eb3dd6bb019343f66303a5c9e4bddca2ac12f15 (patch)
tree9e12018820e6736835436f9f7fb100a9e3d2cb06
parentf0491a98f75fd1c923e496f2362668e3036e6e5d (diff)
usb: phy: am335x: fix race condition in _probe (bnc#1012628).
-rw-r--r--patches.kernel.org/4.20.8-322-usb-phy-am335x-fix-race-condition-in-_probe.patch50
-rw-r--r--series.conf1
2 files changed, 51 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.8-322-usb-phy-am335x-fix-race-condition-in-_probe.patch b/patches.kernel.org/4.20.8-322-usb-phy-am335x-fix-race-condition-in-_probe.patch
new file mode 100644
index 0000000000..bdc123234e
--- /dev/null
+++ b/patches.kernel.org/4.20.8-322-usb-phy-am335x-fix-race-condition-in-_probe.patch
@@ -0,0 +1,50 @@
+From: Bin Liu <b-liu@ti.com>
+Date: Wed, 16 Jan 2019 11:54:07 -0600
+Subject: [PATCH] usb: phy: am335x: fix race condition in _probe
+References: bnc#1012628
+Patch-mainline: 4.20.8
+Git-commit: a53469a68eb886e84dd8b69a1458a623d3591793
+
+commit a53469a68eb886e84dd8b69a1458a623d3591793 upstream.
+
+power off the phy should be done before populate the phy. Otherwise,
+am335x_init() could be called by the phy owner to power on the phy first,
+then am335x_phy_probe() turns off the phy again without the caller knowing
+it.
+
+Fixes: 2fc711d76352 ("usb: phy: am335x: Enable USB remote wakeup using PHY wakeup")
+Cc: stable@vger.kernel.org # v3.18+
+Signed-off-by: Bin Liu <b-liu@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/usb/phy/phy-am335x.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c
+index 27bdb7222527..f5f0568d8533 100644
+--- a/drivers/usb/phy/phy-am335x.c
++++ b/drivers/usb/phy/phy-am335x.c
+@@ -61,9 +61,6 @@ static int am335x_phy_probe(struct platform_device *pdev)
+ if (ret)
+ return ret;
+
+- ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
+- if (ret)
+- return ret;
+ am_phy->usb_phy_gen.phy.init = am335x_init;
+ am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown;
+
+@@ -82,7 +79,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
+ device_set_wakeup_enable(dev, false);
+ phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false);
+
+- return 0;
++ return usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
+ }
+
+ static int am335x_phy_remove(struct platform_device *pdev)
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 3fb65501e3..1b4be3351b 100644
--- a/series.conf
+++ b/series.conf
@@ -1058,6 +1058,7 @@
patches.kernel.org/4.20.8-319-futex-Handle-early-deadlock-return-correctly.patch
patches.kernel.org/4.20.8-320-irqchip-gic-v3-its-Plug-allocation-race-for-de.patch
patches.kernel.org/4.20.8-321-arm64-dts-allwinner-a64-Fix-USB-OTG-regulator.patch
+ patches.kernel.org/4.20.8-322-usb-phy-am335x-fix-race-condition-in-_probe.patch
########################################################
# Build fixes that apply to the vanilla kernel too.