VT-d: avoid infinite recursion on domain_context_mapping_one() error path
authorJan Beulich <jbeulich@suse.com>
Thu, 7 Apr 2022 10:31:16 +0000 (12:31 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 7 Apr 2022 10:31:16 +0000 (12:31 +0200)
commit99d829dba1390b98a3ca07b365713e62182ee7ca
tree3f7418d8c4363399bcfb34855e9c2f58c20a103c
parent608394b906e71587f02e6662597bc985bad33a5a
VT-d: avoid infinite recursion on domain_context_mapping_one() error path

Despite the comment there infinite recursion was still possible, by
flip-flopping between two domains. This is because prev_dom is derived
from the DID found in the context entry, which was already updated by
the time error recovery is invoked. Simply introduce yet another mode
flag to prevent rolling back an in-progress roll-back of a prior
mapping attempt.

Also drop the existing recursion prevention for having been dead anyway:
Earlier in the function we already bail when prev_dom == domain.

Fixes: 8f41e481b485 ("VT-d: re-assign devices directly")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/vtd.h