VT-d: avoid infinite recursion on domain_context_mapping_one() error path
authorJan Beulich <jbeulich@suse.com>
Fri, 8 Apr 2022 12:57:25 +0000 (14:57 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 8 Apr 2022 12:57:25 +0000 (14:57 +0200)
commiteedc5acfb32ec35c38e9b5fcaa3d28d8b0971855
tree3c3c4058c1b06867706f89d52fc0a91a6a6af024
parent0497023ae57649a23cde211dd022522724f993b6
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>
master commit: 99d829dba1390b98a3ca07b365713e62182ee7ca
master date: 2022-04-07 12:31:16 +0200
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/vtd.h