mirror of
https://github.com/bobranten/Ext4Fsd.git
synced 2026-03-16 05:10:37 -05:00
add timeouts to remaining infinite waits in pnp.c and fsctl.c
The previous commit missed three infinite KeWaitForSingleObject calls: - pnp.c: Ext2PnpRemove and Ext2PnpSurpriseRemove wait forever for the lower driver to complete the PnP IRP after device removal - fsctl.c: Ext2IsMediaWriteProtected waits forever for the write-protect check IRP to complete All three now use 30-second timeouts with IRP cancellation on timeout, matching the pattern used in block.c.
This commit is contained in:
@@ -2019,15 +2019,23 @@ Ext2IsMediaWriteProtected (
|
||||
Status = IoCallDriver(TargetDevice, Irp);
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
LARGE_INTEGER Timeout;
|
||||
Timeout.QuadPart = (LONGLONG)-30 * 10 * 1000 * 1000; /* 30 seconds */
|
||||
|
||||
(VOID) KeWaitForSingleObject( &Event,
|
||||
Status = KeWaitForSingleObject( &Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
(PLARGE_INTEGER)NULL );
|
||||
&Timeout );
|
||||
|
||||
if (Status == STATUS_TIMEOUT) {
|
||||
IoCancelIrp(Irp);
|
||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||
Status = STATUS_IO_TIMEOUT;
|
||||
} else {
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
}
|
||||
|
||||
return (BOOLEAN)(Status == STATUS_MEDIA_WRITE_PROTECTED);
|
||||
}
|
||||
|
||||
@@ -198,11 +198,20 @@ Ext2PnpQueryRemove (
|
||||
IrpContext->Irp);
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
KeWaitForSingleObject( &Event,
|
||||
LARGE_INTEGER Timeout;
|
||||
Timeout.QuadPart = (LONGLONG)-30 * 10 * 1000 * 1000; /* 30 seconds */
|
||||
|
||||
Status = KeWaitForSingleObject( &Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL );
|
||||
&Timeout );
|
||||
|
||||
if (Status == STATUS_TIMEOUT) {
|
||||
IoCancelIrp(IrpContext->Irp);
|
||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||
}
|
||||
|
||||
Status = IrpContext->Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
@@ -270,12 +279,19 @@ Ext2PnpRemove (
|
||||
IrpContext->Irp);
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
LARGE_INTEGER Timeout;
|
||||
Timeout.QuadPart = (LONGLONG)-30 * 10 * 1000 * 1000; /* 30 seconds */
|
||||
|
||||
KeWaitForSingleObject( &Event,
|
||||
Status = KeWaitForSingleObject( &Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL );
|
||||
&Timeout );
|
||||
|
||||
if (Status == STATUS_TIMEOUT) {
|
||||
IoCancelIrp(IrpContext->Irp);
|
||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||
}
|
||||
|
||||
Status = IrpContext->Irp->IoStatus.Status;
|
||||
}
|
||||
@@ -342,12 +358,19 @@ Ext2PnpSurpriseRemove (
|
||||
IrpContext->Irp);
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
LARGE_INTEGER Timeout;
|
||||
Timeout.QuadPart = (LONGLONG)-30 * 10 * 1000 * 1000; /* 30 seconds */
|
||||
|
||||
KeWaitForSingleObject( &Event,
|
||||
Status = KeWaitForSingleObject( &Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL );
|
||||
&Timeout );
|
||||
|
||||
if (Status == STATUS_TIMEOUT) {
|
||||
IoCancelIrp(IrpContext->Irp);
|
||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||
}
|
||||
|
||||
Status = IrpContext->Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user