mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[ACPI]
- The width parameter in AcpiOsReadPciConfiguration and AcpiOsWritePciConfiguration was in bits but we were treating it as a width in bytes - This caused overreads, memory corruption, and crashes when these functions were called (VMWare was particularly picky about bad accesses to the PCI configuration space) - A hack was (unknowingly) added which prevented some crashes but had a side-effect of causing the partial disruption of ACPI's PCI configuration space accesses while the others that went through wrote bad data to the PCI config space or corrupted kernel memory svn path=/trunk/; revision=53880
This commit is contained in:
parent
b60019815f
commit
885910a88e
1 changed files with 18 additions and 16 deletions
|
@ -456,26 +456,28 @@ AcpiOsReadPciConfiguration (
|
|||
NTSTATUS Status;
|
||||
PCI_SLOT_NUMBER slot;
|
||||
|
||||
if (Register == 0 || PciId->Device == 0 ||
|
||||
Register + Width > PCI_COMMON_HDR_LENGTH)
|
||||
return AE_ERROR;
|
||||
|
||||
slot.u.AsULONG = 0;
|
||||
slot.u.bits.DeviceNumber = PciId->Device;
|
||||
slot.u.bits.FunctionNumber = PciId->Function;
|
||||
|
||||
DPRINT("AcpiOsReadPciConfiguration, slot=0x%X, func=0x%X\n", slot.u.AsULONG, Register);
|
||||
|
||||
Status = HalGetBusDataByOffset(PCIConfiguration,
|
||||
PciId->Bus,
|
||||
slot.u.AsULONG,
|
||||
Value,
|
||||
Register,
|
||||
Width);
|
||||
(Width / 8));
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
return AE_OK;
|
||||
if (Status == 0 || Status == 2)
|
||||
{
|
||||
DPRINT1("HalGetBusDataByOffset failed (Status = %d)\n", Status);
|
||||
return AE_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
return AE_ERROR;
|
||||
{
|
||||
return AE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
|
@ -489,26 +491,26 @@ AcpiOsWritePciConfiguration (
|
|||
ULONG buf = Value;
|
||||
PCI_SLOT_NUMBER slot;
|
||||
|
||||
if (Register == 0 || PciId->Device == 0 ||
|
||||
Register + Width > PCI_COMMON_HDR_LENGTH)
|
||||
return AE_ERROR;
|
||||
|
||||
slot.u.AsULONG = 0;
|
||||
slot.u.bits.DeviceNumber = PciId->Device;
|
||||
slot.u.bits.FunctionNumber = PciId->Function;
|
||||
|
||||
DPRINT("AcpiOsWritePciConfiguration, slot=0x%x\n", slot.u.AsULONG);
|
||||
|
||||
Status = HalSetBusDataByOffset(PCIConfiguration,
|
||||
PciId->Bus,
|
||||
slot.u.AsULONG,
|
||||
&buf,
|
||||
Register,
|
||||
Width);
|
||||
(Width / 8));
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
return AE_OK;
|
||||
if (Status == 0 || Status == 2)
|
||||
{
|
||||
DPRINT1("HalSetBusDataByOffset failed (Status = %d)\n", Status);
|
||||
return AE_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
return AE_ERROR;
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
|
|
Loading…
Reference in a new issue