]> www.infradead.org Git - users/willy/xarray.git/commit
usb: dwc3: st: fix probed platform device ref count on probe error path
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 14 Aug 2024 09:39:56 +0000 (11:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Aug 2024 09:34:26 +0000 (17:34 +0800)
commitddfcfeba891064b88bb844208b43bef2ef970f0c
tree523c08ee901098976cdac1d310f628661e265a17
parent72fca8371f205d654f95b09cd023a71fd5307041
usb: dwc3: st: fix probed platform device ref count on probe error path

The probe function never performs any paltform device allocation, thus
error path "undo_platform_dev_alloc" is entirely bogus.  It drops the
reference count from the platform device being probed.  If error path is
triggered, this will lead to unbalanced device reference counts and
premature release of device resources, thus possible use-after-free when
releasing remaining devm-managed resources.

Fixes: f83fca0707c6 ("usb: dwc3: add ST dwc3 glue layer to manage dwc3 HC")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20240814093957.37940-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/dwc3-st.c