finish_type_change() returns a negative int on error, but the
current code checks if ( !rc ). We also need to treat
finish_type_change()'s return codes cumulatively in the
success case (don't overwrite a 1 returned while processing
the hostp2m if processing an altp2m returns 0).
The breakage was introduced by commit
0fb4b58c8b
("x86/altp2m: fix display frozen when switching to a new view
early").
Properly indent the out: label while at it.
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
rc = finish_type_change(hostp2m, first_gfn, max_nr);
- if ( !rc )
+ if ( rc < 0 )
goto out;
#ifdef CONFIG_HVM
if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) )
{
struct p2m_domain *altp2m = d->arch.altp2m_p2m[i];
+ int rc1;
p2m_lock(altp2m);
- rc = finish_type_change(altp2m, first_gfn, max_nr);
+ rc1 = finish_type_change(altp2m, first_gfn, max_nr);
p2m_unlock(altp2m);
- if ( !rc )
+ if ( rc1 < 0 )
+ {
+ rc = rc1;
goto out;
+ }
+
+ rc |= rc1;
}
}
#endif
-out:
+ out:
p2m_unlock(hostp2m);
return rc;