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:
Jan Beulich committed 2022-12-02 10:25:59 +01:00
1 parent 432ffda15f
commit 5488cc3a4d
2 files changed
+9

No files matched your search

+3
View File
@@ -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)
+6
View File
@@ -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:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.