mshv: release mutex on region invalidation failure
In the region invalidation failure path in
mshv_region_interval_invalidate(), the region mutex is not released. Fix
it by releasing the mutex in the failure path.
Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Fixes: b9a66cd5cc ("mshv: Add support for movable memory regions")
Acked-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Roman Kisel <vdso@mailbox.org>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
committed by
Wei Liu
parent
52f758edc9
commit
173d6f64f9
@@ -511,7 +511,7 @@ static bool mshv_region_interval_invalidate(struct mmu_interval_notifier *mni,
|
||||
ret = mshv_region_remap_pages(region, HV_MAP_GPA_NO_ACCESS,
|
||||
page_offset, page_count);
|
||||
if (ret)
|
||||
goto out_fail;
|
||||
goto out_unlock;
|
||||
|
||||
mshv_region_invalidate_pages(region, page_offset, page_count);
|
||||
|
||||
@@ -519,6 +519,8 @@ static bool mshv_region_interval_invalidate(struct mmu_interval_notifier *mni,
|
||||
|
||||
return true;
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(®ion->mutex);
|
||||
out_fail:
|
||||
WARN_ONCE(ret,
|
||||
"Failed to invalidate region %#llx-%#llx (range %#lx-%#lx, event: %u, pages %#llx-%#llx, mm: %#llx): %d\n",
|
||||
|
||||
Reference in New Issue
Block a user