usb: musb: sunxi: Explicitly release USB PHY on exit
PATCH v2 1/1 usb: musb: sunxi: Explicitly release USB PHY on exit
This fixes a kernel oops when unloading the driver due to usb_put_phy being called after usb_phy_generic_unregister when the device is detached. Calling usb_phy_generic_unregister causes x->dev->driver to be NULL in usb_put_phy and results in a NULL pointer dereference.
---
Changes for v2:
- Use devm_usb_put_phy instead of usb_put_phy
drivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/musb/sunxi.c +2 -0
@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb)if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent); +devm_usb_put_phy (glue->dev, glue->xceiv); +return 0 ; }
Signature · 1 line
2.14.2
Quoted 19 lines · Jonathan Liu
This fixes a kernel oops when unloading the driver due to
usb_put_phybeing called afterusb_phy_generic_unregisterwhen the device is detached. Callingusb_phy_generic_unregistercausesx->dev->driverto be NULL inusb_put_phyand results in a NULL pointer dereference.Cc stable at vger.kernel.org # v4.3+Signed-off-by Jonathan Liu <[email protected]>---
Changes for v2:
- Usedevm_usb_put_phyinstead ofusb_put_phydrivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb/sunxi.c +0
-0
drivers/usb/musb/sunxi.c static int sunxi_musb_exit(struct musb *musb) · line 303
Quoted 7 lines
drivers/usb/musb/sunxi.c +2
-0@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb)if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent); +devm_usb_put_phy (glue->dev, glue->xceiv); +return 0 ; }
Applied. Thanks.
-Bin.
Quoted 23 lines · Bin Liu
Quoted 22 lines · Jonathan Liu
This fixes a kernel oops when unloading the driver due to
usb_put_phybeing called afterusb_phy_generic_unregisterwhen the device is detached. Callingusb_phy_generic_unregistercausesx->dev->driverto be NULL inusb_put_phyand results in a NULL pointer dereference.Cc stable at vger.kernel.org # v4.3+Signed-off-by Jonathan Liu <[email protected]>---
Changes for v2:
- Usedevm_usb_put_phyinstead ofusb_put_phydrivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb/sunxi.c +0
-0@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb)if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent);
Quoted 9 lines
drivers/usb/musb/sunxi.c static int sunxi_musb_exit(struct musb *musb) · line 303
Quoted 4 lines
drivers/usb/musb/sunxi.c +2
-0+devm_usb_put_phy (glue->dev, glue->xceiv); +return 0 ; }Applied. Thanks.
-Bin.
Which repository was it applied to?
Regards,
Jonathan
Bin Liu
maintainerQuoted 31 lines · Jonathan Liu
Quoted 29 lines · Bin Liu
Quoted 26 lines · Jonathan Liu
This fixes a kernel oops when unloading the driver due to
usb_put_phybeing called afterusb_phy_generic_unregisterwhen the device is detached. Callingusb_phy_generic_unregistercausesx->dev->driverto be NULL inusb_put_phyand results in a NULL pointer dereference.Cc stable at vger.kernel.org # v4.3+Signed-off-by Jonathan Liu <[email protected]>---
Changes for v2:
- Usedevm_usb_put_phyinstead ofusb_put_phydrivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb/sunxi.c +2
-0@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb)if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent); +devm_usb_put_phy (glue->dev, glue->xceiv); +return 0 ; }
Quoted 4 lines
Quoted 2 lines
Applied. Thanks.
-Bin.Which repository was it applied to?
I don't have a public repo (yet), but the patch has been sent to Greg, so it should be merged into the next -rc.
Regards,
-Bin.
Quoted 35 lines · Bin Liu
Quoted 34 lines · Jonathan Liu
Quoted 32 lines · Bin Liu
Quoted 19 lines · Jonathan Liu
This fixes a kernel oops when unloading the driver due to
usb_put_phybeing called afterusb_phy_generic_unregisterwhen the device is detached. Callingusb_phy_generic_unregistercausesx->dev->driverto be NULL inusb_put_phyand results in a NULL pointer dereference.Cc stable at vger.kernel.org # v4.3+Signed-off-by Jonathan Liu <[email protected]>---
Changes for v2:
- Usedevm_usb_put_phyinstead ofusb_put_phydrivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb/sunxi.c +0
-0drivers/usb/musb/sunxi.c static int sunxi_musb_exit(struct musb *musb) · line 303
Quoted 7 lines
drivers/usb/musb/sunxi.c +2
-0@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb)if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent); +devm_usb_put_phy (glue->dev, glue->xceiv); +return 0 ; }Applied. Thanks.
-Bin.
Quoted 7 lines
Quoted 1 line
Which repository was it applied to?
I don't have a public repo (yet), but the patch has been sent to Greg, so it should be merged into the next -rc.
Regards,
-Bin.
The MAINTAINERS file hasgit://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git listed as the tree for drivers/usb/musb/. I guess that should be updated.
Regards,
Jonathan
Bin Liu
maintainerQuoted 41 lines · Jonathan Liu
Quoted 40 lines · Bin Liu
Quoted 31 lines · Jonathan Liu
Quoted 29 lines · Bin Liu
Quoted 26 lines · Jonathan Liu
This fixes a kernel oops when unloading the driver due to
usb_put_phybeing called afterusb_phy_generic_unregisterwhen the device is detached. Callingusb_phy_generic_unregistercausesx->dev->driverto be NULL inusb_put_phyand results in a NULL pointer dereference.Cc stable at vger.kernel.org # v4.3+Signed-off-by Jonathan Liu <[email protected]>---
Changes for v2:
- Usedevm_usb_put_phyinstead ofusb_put_phydrivers/usb/musb/sunxi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb/sunxi.c +2
-0@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb)if (test_bit (SUNXI_MUSB_FL_HAS_SRAM , &glue->flags))sunxi_sram_release (musb->controller->parent); +devm_usb_put_phy (glue->dev, glue->xceiv); +return 0 ; }Quoted 4 lines
Quoted 2 lines
Applied. Thanks.
-Bin.Which repository was it applied to?
I don't have a public repo (yet), but the patch has been sent to Greg, so it should be merged into the next -rc.
Quoted 6 lines
Quoted 2 lines
Regards,
-Bin.The
MAINTAINERSfile hasgit://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.gitlisted as the tree fordrivers/usb/musb/. I guess that should be updated.
I will create a patch for it. Thanks for reporting this.
Regards,
-Bin.