xen/grants: fix hypercall continuation for GNTTABOP_cache_flush
authorJuergen Gross <jgross@suse.com>
Wed, 22 Apr 2020 13:07:53 +0000 (15:07 +0200)
committerJulien Grall <jgrall@amazon.com>
Wed, 29 Apr 2020 13:12:50 +0000 (14:12 +0100)
commit46d8f69d466a05863737fb81d8c9ef39c3be8b45
tree3d2a11d19b31bcbd13cca70fcf352c4da0ca0e1d
parentf9bf746258eb53011f863571c7073037202b6743
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>
xen/common/grant_table.c