Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8fe610d authored by Arumuga Durai A's avatar Arumuga Durai A Committed by Sriharsha Allenki
Browse files

USB: phy: msm: Fix out of bound access



When invalid value passed from user-space to modify the
POWER_SUPPLY_HEALTH property for eg)
echo 500 > /sys/devices/soc/78db000.usb/power_supply/usb/health
out of bound access happens while power_supply uevent updating
all power_supply properties due to change of power_supply
property. Fix this by adding proper check before modifying
POWER_SUPPLY_HEALTH property.

CRs-Fixed: 2068932
Change-Id: Ib6679d7045429146a56075caccd3dd8c0cb12dff
Signed-off-by: default avatarArumuga Durai A <cadurai@codeaurora.org>
parent 35eaac3d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3623,6 +3623,9 @@ static int otg_power_set_property_usb(struct power_supply *psy,
				motg->chg_type, psy->type);
		break;
	case POWER_SUPPLY_PROP_HEALTH:
		if (val->intval > POWER_SUPPLY_HEALTH_HOT)
			motg->usbin_health = 0;
		else
			motg->usbin_health = val->intval;
		break;
	default: