public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci/dmar: correct off-by-one error
@ 2009-08-19 21:26 Troy Heber
  0 siblings, 0 replies; only message in thread
From: Troy Heber @ 2009-08-19 21:26 UTC (permalink / raw)
  To: David Woodhouse, iommu; +Cc: linux-pci, linux-kernel

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@hp.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);
 	}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-19 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-19 21:26 [PATCH] pci/dmar: correct off-by-one error Troy Heber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox