mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
xen/grants: fix hypercall continuation for GNTTABOP_cache_flush
The GNTTABOP_cache_flush hypercall has a wrong test for hypercall
continuation, the test today is:
if ( rc > 0 || opaque_out != 0 )
Unfortunately this will be true even in case of an error (rc < 0),
possibly leading to very long lasting hypercalls (times of more
than an hour have been observed in a test case).
Correct the test condition to result in false with rc < 0 and set
opaque_out only if no error occurred, to be on the safe side.
Partially-suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
master commit: 46d8f69d46
master date: 2020-04-29 14:12:50 +0100
This commit is contained in:
1 parent
d2aecd86c4
commit
8b6d4e234b
1 file changed
+3
-3
@@ -3633,12 +3633,12 @@ do_grant_table_op(
|
||||
if ( unlikely(!guest_handle_okay(cflush, count)) )
|
||||
goto out;
|
||||
rc = gnttab_cache_flush(cflush, &opaque_in, count);
|
||||
if ( rc > 0 )
|
||||
if ( rc >= 0 )
|
||||
{
|
||||
guest_handle_add_offset(cflush, rc);
|
||||
uop = guest_handle_cast(cflush, void);
|
||||
opaque_out = opaque_in;
|
||||
}
|
||||
opaque_out = opaque_in;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3648,7 +3648,7 @@ do_grant_table_op(
|
||||
}
|
||||
|
||||
out:
|
||||
if ( rc > 0 || opaque_out != 0 )
|
||||
if ( rc > 0 || (opaque_out != 0 && rc == 0) )
|
||||
{
|
||||
/* Adjust rc, see gnttab_copy() for why this is needed. */
|
||||
if ( cmd == GNTTABOP_copy )
|
||||
|
||||