[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/5] xen/vpci: purge BAR rangeset contents before use
It's possible for the BAR rangeset to contain stale data when used in modify_bars() if previous calls to modify_bars() resulted in errors. Fix by always purging the rangeset before usage, thus getting rid of any previous stale data. Remove the ASSERT that checked whether the rangeset was empty, it was incorrect. Fixes: 52ebde3cfae2 ('vpci/header: program p2m with guest BAR view') Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- xen/drivers/vpci/header.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index 469f4977441a..b9756b364300 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -338,6 +338,12 @@ static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only) if ( !bar->mem ) continue; + /* + * Empty before use, previous failures might have left stale data in + * the rangeset. + */ + rangeset_purge(bar->mem); + if ( !MAPPABLE_BAR(bar) || (rom_only ? bar->type != VPCI_BAR_ROM : (bar->type == VPCI_BAR_ROM && !header->rom_enabled)) || @@ -353,8 +359,6 @@ static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only) continue; } - ASSERT(rangeset_is_empty(bar->mem)); - /* * Make sure that the guest set address has the same page offset * as the physical address on the host or otherwise things won't work as -- 2.49.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |