[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20090819212611.GA7964@pc.troyhebe>
Date: Wed, 19 Aug 2009 15:26:11 -0600
From: Troy Heber <troy.heber@...com>
To: David Woodhouse <dwmw2@...radead.org>,
iommu@...ts.linux-foundation.org
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] pci/dmar: correct off-by-one error
pci/dmar: correct off-by-one error in dmar_fault()
DMAR faults are recorded into a ring of "fault recording registers".
fault_index is a 0-based index into the ring. The code allows the
0-based fault_index to be equal to the total number of fault registers
available from the cap_num_fault_regs() macro, which causes access
beyond the last available register.
Signed-off-by Troy Heber <troy.heber@...com>
---
drivers/pci/dmar.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 7b287cb..c0c776f 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -1212,7 +1212,7 @@ irqreturn_t dmar_fault(int irq, void *dev_id)
source_id, guest_addr);
fault_index++;
- if (fault_index > cap_num_fault_regs(iommu->cap))
+ if (fault_index >= cap_num_fault_regs(iommu->cap))
fault_index = 0;
spin_lock_irqsave(&iommu->register_lock, flag);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists