Skip to content

Commit 173d6f6

Browse files
Anirudh Rayabharam (Microsoft)liuw
authored andcommitted
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) <[email protected]> Fixes: b9a66cd ("mshv: Add support for movable memory regions") Acked-by: Stanislav Kinsburskii <[email protected]> Reviewed-by: Roman Kisel <[email protected]> Signed-off-by: Wei Liu <[email protected]>
1 parent 52f758e commit 173d6f6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/hv/mshv_regions.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,16 @@ static bool mshv_region_interval_invalidate(struct mmu_interval_notifier *mni,
511511
ret = mshv_region_remap_pages(region, HV_MAP_GPA_NO_ACCESS,
512512
page_offset, page_count);
513513
if (ret)
514-
goto out_fail;
514+
goto out_unlock;
515515

516516
mshv_region_invalidate_pages(region, page_offset, page_count);
517517

518518
mutex_unlock(&region->mutex);
519519

520520
return true;
521521

522+
out_unlock:
523+
mutex_unlock(&region->mutex);
522524
out_fail:
523525
WARN_ONCE(ret,
524526
"Failed to invalidate region %#llx-%#llx (range %#lx-%#lx, event: %u, pages %#llx-%#llx, mm: %#llx): %d\n",

0 commit comments

Comments
 (0)