mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
gnttab: bail from GFN-storing loops early in case of error
The contents of the output arrays are undefined anyway when the operation itself gets marked as failed. There's no value in trying to continue after a guest memory access failure. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
432ffda15f
commit
5488cc3a4d
2 files changed
+9
No files matched your search
@@ -179,7 +179,10 @@ int compat_grant_table_op(
|
||||
unsigned int frame = (_s_)->frame_list.p[i]; \
|
||||
if ( __copy_to_compat_offset((_d_)->frame_list, \
|
||||
i, &frame, 1) ) \
|
||||
{ \
|
||||
(_s_)->status = GNTST_bad_virt_addr; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -2101,7 +2101,10 @@ gnttab_setup_table(
|
||||
BUG_ON(SHARED_M2P(gmfn));
|
||||
|
||||
if ( __copy_to_guest_offset(op.frame_list, i, &gmfn, 1) )
|
||||
{
|
||||
op.status = GNTST_bad_virt_addr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unlock:
|
||||
@@ -3311,7 +3314,10 @@ gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop,
|
||||
{
|
||||
gmfn = gfn_x(gnttab_status_gfn(d, gt, i));
|
||||
if ( __copy_to_guest_offset(op.frame_list, i, &gmfn, 1) )
|
||||
{
|
||||
op.status = GNTST_bad_virt_addr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unlock:
|
||||
|
||||