From d6098c0d6e2f75391963a9163842e261ecf053bb Mon Sep 17 00:00:00 2001 From: tsi Date: Wed, 14 May 2008 15:40:46 +0000 Subject: 49. Avoid unpredictable behaviour on PCI-X and/or PCI Express capable ix86, x86_64 and PowerPC systems (Marc La France). --- programs/Xserver/hw/xfree86/CHANGELOG | 4 +++- programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c | 20 +++++++++++++++++++- programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c | 16 +++++++++++++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/programs/Xserver/hw/xfree86/CHANGELOG b/programs/Xserver/hw/xfree86/CHANGELOG index d53b1ca54..be12cb817 100644 --- a/programs/Xserver/hw/xfree86/CHANGELOG +++ b/programs/Xserver/hw/xfree86/CHANGELOG @@ -1,4 +1,6 @@ XFree86 4.7.99.18 (xx May 2008) + 49. Avoid unpredictable behaviour on PCI-X and/or PCI Express capable ix86, + x86_64 and PowerPC systems (Marc La France). XFree86 4.7.99.17 (9 May 2008) 48. Fix ATIPreInit() glitch that caused it to ignore the posiibility that the @@ -20746,4 +20748,4 @@ XFree86 3.0a (28 April 1994) XFree86 3.0 (26 April 1994) -$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.3958 2008/05/08 20:59:18 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.3959 2008/05/09 11:07:05 dawes Exp $ diff --git a/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c b/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c index d400dc643..114f07c94 100644 --- a/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c +++ b/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.26tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.27 2004/10/15 03:08:32 tsi Exp $ */ /* * ix86Pci.c - x86 PCI driver * @@ -570,6 +570,9 @@ ix86PciReadLongCFG1(PCITAG Tag, int reg) ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); #endif + if ((reg < 0) || (reg >= 256)) + return PCI_NOT_FOUND; + addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); outl(PCI_CFGMECH1_ADDRESS_REG, addr); data = inl(PCI_CFGMECH1_DATA_REG); @@ -592,6 +595,9 @@ ix86PciReadLongCFG2(PCITAG Tag, int reg) ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); #endif + if ((reg < 0) || (reg >= 256)) + return PCI_NOT_FOUND; + forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); @@ -621,6 +627,9 @@ ix86PciWriteLongCFG1(PCITAG Tag, int reg, CARD32 data) { CARD32 addr; + if ((reg < 0) || (reg >= 256)) + return; + addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); outl(PCI_CFGMECH1_ADDRESS_REG, addr); outl(PCI_CFGMECH1_DATA_REG, data); @@ -633,6 +642,9 @@ ix86PciWriteLongCFG2(PCITAG Tag, int reg, CARD32 data) CARD32 addr; CARD8 forward, enable; + if ((reg < 0) || (reg >= 256)) + return; + forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); @@ -660,6 +672,9 @@ ix86PciSetBitsLongCFG1(PCITAG Tag, int reg, CARD32 mask, CARD32 val) ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); #endif + if ((reg < 0) || (reg >= 256)) + return; + addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); outl(PCI_CFGMECH1_ADDRESS_REG, addr); data = inl(PCI_CFGMECH1_DATA_REG); @@ -678,6 +693,9 @@ ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val) ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); #endif + if ((reg < 0) || (reg >= 256)) + return; + forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); diff --git a/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c b/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c index 3347555ff..9763c9c71 100644 --- a/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c +++ b/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.9tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.10 2005/03/29 17:54:00 tsi Exp $ */ /* * ppcPci.c - PowerPC PCI access functions * @@ -227,11 +227,14 @@ void buserr(int sig) static CARD32 pciCfgMech1Read(PCITAG tag, int offset) { - unsigned long rv = 0xffffffff; + CARD32 rv = 0xffffffff; #ifdef DEBUGPCI ErrorF("pciCfgMech1Read(tag=%08lx,offset=%08x)\n", tag, offset); #endif + if ((offset < 0) || (offset >= 256)) + return rv; + signal(SIGBUS, buserr); buserr_detected = 0; @@ -258,6 +261,9 @@ pciCfgMech1Write(PCITAG tag, int offset, CARD32 val) tag, offset, (unsigned long)val); #endif + if ((offset < 0) || (offset >= 256)) + return; + signal(SIGBUS, SIG_IGN); outl(0xCF8, PCI_EN | tag | (offset & 0xfc)); @@ -274,8 +280,12 @@ pciCfgMech1Write(PCITAG tag, int offset, CARD32 val) static void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, CARD32 val) { - unsigned long rv = 0xffffffff; + CARD32 rv; + + if ((offset < 0) || (offset >= 256)) + return; + rv = 0xffffffff; signal(SIGBUS, buserr); outl(0xCF8, PCI_EN | tag | (offset & 0xfc)); -- cgit v1.2.3