There's no need to call vfree() with the lock still held.
Signed-off-by: Jan Beulich <[email protected]>
---
In fact for the purposes of the function the P2M lock could really be
obtained merely in read mode, and it could be dropped immediately in both
the main "if()" and its "else if()". If only there wasn't the error
handling after copy_to_guest(): Dropping the paging lock ahead of that
call, we rely solely on the P2M lock to also guard the changing of
d->arch.hvm.dirty_vram.sh and what it points to. Question is why dropping
the paging lock (but continuing to hold the P2M lock) is necessary there
in the first place.
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -1219,8 +1219,8 @@ int shadow_track_dirty_vram(struct domai
paging_unlock(d);
rc = -EFAULT;
}
- vfree(dirty_bitmap);
p2m_unlock(p2m_get_hostp2m(d));
+ vfree(dirty_bitmap);
return rc;
}