From patchwork Wed Aug 19 21:26:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Heber X-Patchwork-Id: 42787 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7JLQEeA016709 for ; Wed, 19 Aug 2009 21:26:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753144AbZHSV0L (ORCPT ); Wed, 19 Aug 2009 17:26:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753111AbZHSV0L (ORCPT ); Wed, 19 Aug 2009 17:26:11 -0400 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]:26276 "EHLO g5t0006.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbZHSV0K (ORCPT ); Wed, 19 Aug 2009 17:26:10 -0400 Received: from smtp1.fc.hp.com (smtp1.fc.hp.com [15.15.136.127]) by g5t0006.atlanta.hp.com (Postfix) with ESMTP id EF6FAC151; Wed, 19 Aug 2009 21:26:11 +0000 (UTC) Received: from ldl (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id 9DEBE255E76; Wed, 19 Aug 2009 20:45:47 +0000 (UTC) Received: by ldl (Postfix, from userid 1000) id 93695228001; Wed, 19 Aug 2009 15:26:11 -0600 (MDT) Date: Wed, 19 Aug 2009 15:26:11 -0600 From: Troy Heber To: David Woodhouse , iommu@lists.linux-foundation.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pci/dmar: correct off-by-one error Message-ID: <20090819212611.GA7964@pc.troyhebe> Mail-Followup-To: David Woodhouse , iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 --- drivers/pci/dmar.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }