mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[SERIAL]
- Fix a race condition svn path=/trunk/; revision=61113
This commit is contained in:
parent
1aa6d29ccb
commit
48f677b66a
1 changed files with 7 additions and 11 deletions
|
@ -827,12 +827,10 @@ SerialDeviceControl(
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME: Race condition here:
|
IoMarkIrpPending(Irp);
|
||||||
* If an interrupt comes before we can mark the Irp
|
|
||||||
* as pending, it might be possible to complete the
|
|
||||||
* Irp before pending it, leading to a crash! */
|
|
||||||
WaitingIrp = InterlockedCompareExchangePointer(
|
WaitingIrp = InterlockedCompareExchangePointer(
|
||||||
(PVOID)&DeviceExtension->WaitOnMaskIrp,
|
&DeviceExtension->WaitOnMaskIrp,
|
||||||
Irp,
|
Irp,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -841,13 +839,11 @@ SerialDeviceControl(
|
||||||
{
|
{
|
||||||
/* Unable to have a 2nd pending IRP for this IOCTL */
|
/* Unable to have a 2nd pending IRP for this IOCTL */
|
||||||
WARN_(SERIAL, "Unable to pend a second IRP for IOCTL_SERIAL_WAIT_ON_MASK\n");
|
WARN_(SERIAL, "Unable to pend a second IRP for IOCTL_SERIAL_WAIT_ON_MASK\n");
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Irp->IoStatus.Information = 0;
|
||||||
}
|
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||||
else
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
{
|
|
||||||
Status = STATUS_PENDING;
|
|
||||||
/* FIXME: immediately return if a wait event already occurred */
|
|
||||||
}
|
}
|
||||||
|
return STATUS_PENDING;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue