]> git.baikalelectronics.ru Git - kernel.git/commit
usb: hcd: use managed device resources
authorSchmid, Carsten <Carsten_Schmid@mentor.com>
Fri, 23 Aug 2019 14:11:28 +0000 (14:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Aug 2019 20:48:37 +0000 (22:48 +0200)
commit30cf3ff7f0a8261a71e0846f44549d1febd0e666
treec61e24615835399d53a00ca60039f34c97a6c6df
parent00bac0e78a43111a9113a407f4e2b3c472b608fd
usb: hcd: use managed device resources

Using managed device resources in usb_hcd_pci_probe() allows devm usage for
resource subranges, such as the mmio resource for the platform device
created to control host/device mode mux, which is a xhci extended
capability, and sits inside the xhci mmio region.

If managed device resources are not used then "parent" resource
is released before subrange at driver removal as .remove callback is
called before the devres list of resources for this device is walked
and released.

This has been observed with the xhci extended capability driver causing a
use-after-free which is now fixed.

An additional nice benefit is that error handling on driver initialisation
is simplified much.

Signed-off-by: Carsten Schmid <carsten_schmid@mentor.com>
Tested-by: Carsten Schmid <carsten_schmid@mentor.com>
Reviewed-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Fixes: 3160e37cbaa4 ("xhci: Add Intel extended cap / otg phy mux handling")
Cc: <stable@vger.kernel.org> # v4.19+
Link: https://lore.kernel.org/r/1566569488679.31808@mentor.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd-pci.c