]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: phy: isp1301: fix non-OF device reference imbalance
authorJohan Hovold <johan@kernel.org>
Thu, 18 Dec 2025 15:35:16 +0000 (16:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:13 +0000 (12:57 +0100)
commit7501ecfe3e5202490c2d13dc7e181203601fcd69
treeaff7c2abbdd006223424c4c1cd8296f8694e184e
parent2e7c47e2eb3cfeadf78a1ccbac8492c60d508f23
usb: phy: isp1301: fix non-OF device reference imbalance

commit b4b64fda4d30a83a7f00e92a0c8a1d47699609f3 upstream.

A recent change fixing a device reference leak in a UDC driver
introduced a potential use-after-free in the non-OF case as the
isp1301_get_client() helper only increases the reference count for the
returned I2C device in the OF case.

Increment the reference count also for non-OF so that the caller can
decrement it unconditionally.

Note that this is inherently racy just as using the returned I2C device
is since nothing is preventing the PHY driver from being unbound while
in use.

Fixes: c84117912bdd ("USB: lpc32xx_udc: Fix error handling in probe")
Cc: stable@vger.kernel.org
Cc: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Link: https://patch.msgid.link/20251218153519.19453-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/phy/phy-isp1301.c