linux-stable/drivers/phy
Hans de Goede 25b3498485 phy: ti: tusb1210: Resolve charger-det crash if charger psy is unregistered
[ Upstream commit bf6e4ee5c4 ]

The power_supply frame-work is not really designed for there to be
long living in kernel references to power_supply devices.

Specifically unregistering a power_supply while some other code has
a reference to it triggers a WARN in power_supply_unregister():

	WARN_ON(atomic_dec_return(&psy->use_cnt));

Folllowed by the power_supply still getting removed and the
backing data freed anyway, leaving the tusb1210 charger-detect code
with a dangling reference, resulting in a crash the next time
tusb1210_get_online() is called.

Fix this by only holding the reference in tusb1210_get_online()
freeing it at the end of the function. Note this still leaves
a theoretical race window, but it avoids the issue when manually
rmmod-ing the charger chip driver during development.

Fixes: 48969a5623 ("phy: ti: tusb1210: Add charger detection")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240406140821.18624-1-hdegoede@redhat.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-02 16:29:31 +02:00
..
allwinner
amlogic phy: amlogic: phy-meson-g12a-mipi-dphy-analog: fix CNTL2_DIF_TX_CTL0 value 2023-06-09 10:33:58 +02:00
broadcom
cadence
freescale phy: freescale: imx8m-pcie: fix pcie link-up instability 2024-05-02 16:29:31 +02:00
hisilicon phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe() 2023-08-03 10:23:59 +02:00
ingenic
intel
lantiq
marvell phy: marvell: a3700-comphy: Fix hardcoded array size 2024-05-02 16:29:31 +02:00
mediatek phy: phy-mtk-dp: Fix an error code in probe() 2023-08-03 10:23:56 +02:00
microchip
motorola phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins 2023-10-25 12:03:16 +02:00
mscc
qualcomm phy: qcom-snps-femto-v2: use qcom_snps_hsphy_suspend/resume error code 2023-09-13 09:42:20 +02:00
ralink
renesas phy: renesas: rcar-gen3-usb2: Fix returning wrong error code 2024-02-16 19:06:24 +01:00
rockchip phy: rockchip-snps-pcie3: fix clearing PHP_GRF_PCIESEL_CON bits 2024-05-02 16:29:31 +02:00
samsung
socionext
st phy: st: miphy28lp: use _poll_timeout functions for waits 2023-05-24 17:32:41 +01:00
sunplus
tegra phy: tegra: xusb: Add API to retrieve the port number of phy 2024-04-03 15:19:33 +02:00
ti phy: ti: tusb1210: Resolve charger-det crash if charger psy is unregistered 2024-05-02 16:29:31 +02:00
xilinx
Kconfig
Makefile
phy-can-transceiver.c
phy-core-mipi-dphy.c
phy-core.c
phy-lgm-usb.c
phy-lpc18xx-usb-otg.c
phy-pistachio-usb.c
phy-xgene.c