In the Linux kernel, the following vulnerability has been resolved:
phy: tegra: xusb: Fix unbalanced regulator disable in UTMI PHY mode
When transitioning from USBROLEDEVICE to USBROLENONE, the code assumed that the regulator should be disabled. However, if the regulator is marked as always-on, regulatorisenabled() continues to return true, leading to an incorrect attempt to disable a regulator which is not enabled.
This can result in warnings such as:
[ 250.155624] WARNING: CPU: 1 PID: 7326 at drivers/regulator/core.c:3004 regulatordisable+0xe4/0x1a0 [ 250.155652] unbalanced disables for VINSYS5V0
To fix this, we move the regulator control logic into tegra186xusbpadctlidoverride() function since it's directly related to the ID override state. The regulator is now only disabled when the role transitions from USBROLEHOST to USBROLENONE, by checking the VBUS_ID register. This ensures that regulator enable/disable operations are properly balanced and only occur when actually transitioning to/from host mode.