mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 12:00:22 +09:00
ANDROID: KVM: arm64: iommu: Harden __pkvm_iommu_pm_notify
Currently __pkvm_iommu_pm_notify always changes the value of dev->powered following a suspend/resume attempt. This could potentially be abused to force the hypervisor to stop issuing updates to an S2MPU and preserving an old/invalid state. Modify to only update the power state if suspend/resume was successful. Bug: 190463801 Signed-off-by: David Brazdil <dbrazdil@google.com> Change-Id: I285fc822e9fc926c49b9b5e69446790e1edccafb
This commit is contained in:
@@ -360,10 +360,12 @@ int __pkvm_iommu_pm_notify(unsigned long dev_id, enum pkvm_iommu_pm_event event)
|
||||
if (dev) {
|
||||
if (event == PKVM_IOMMU_PM_SUSPEND) {
|
||||
ret = dev->ops->suspend ? dev->ops->suspend(dev) : 0;
|
||||
dev->powered = !!ret;
|
||||
if (!ret)
|
||||
dev->powered = false;
|
||||
} else if (event == PKVM_IOMMU_PM_RESUME) {
|
||||
ret = dev->ops->resume ? dev->ops->resume(dev) : 0;
|
||||
dev->powered = !ret;
|
||||
if (!ret)
|
||||
dev->powered = true;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user