Author: cgutman
Date: Tue Oct 21 19:13:26 2008
New Revision: 36882
URL:
http://svn.reactos.org/svn/reactos?rev=36882&view=rev
Log:
- Fix a bug where we may not complete an irp
- Don't complete the irp in DispPrepareIrpForCancel if it has already been canceled
- Fail if we have a bad transport context
- Call DispDataRequestComplete if we aren't pending in DispTdiListen and
DispTdiConnect
Modified:
branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c
Modified: branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Tue
Oct 21 19:13:26 2008
@@ -50,7 +50,7 @@
TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP was already cancelled).\n"));
- return IRPFinish(Irp, STATUS_CANCELLED);
+ return Irp->IoStatus.Status;
}
VOID DispDataRequestComplete(
@@ -387,13 +387,15 @@
TranContext = IrpSp->FileObject->FsContext;
if (!TranContext) {
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
if (!Connection) {
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
@@ -405,7 +407,10 @@
DispDataRequestComplete,
Irp );
- if (Status == STATUS_PENDING)
+done:
+ if (Status != STATUS_PENDING) {
+ DispDataRequestComplete(Irp, Status, 0);
+ } else
IoMarkIrpPending(Irp);
TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
@@ -530,14 +535,16 @@
if (TranContext == NULL)
{
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
if (Connection == NULL)
{
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
@@ -591,7 +598,10 @@
Irp );
}
- if (Status == STATUS_PENDING)
+done:
+ if (Status != STATUS_PENDING) {
+ DispDataRequestComplete(Irp, Status, 0);
+ } else
IoMarkIrpPending(Irp);
TI_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
@@ -748,13 +758,15 @@
if (TranContext == NULL)
{
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
if (TranContext->Handle.ConnectionContext == NULL)
{
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
/* Initialize a receive request */
@@ -777,15 +789,15 @@
ReceiveInfo->ReceiveFlags,
DispDataRequestComplete,
Irp);
- if (Status != STATUS_PENDING)
- {
- DispDataRequestComplete(Irp, Status, BytesReceived);
- } else {
- IoMarkIrpPending(Irp);
- }
TcpipRecursiveMutexLeave( &TCPLock );
}
+
+done:
+ if (Status != STATUS_PENDING) {
+ DispDataRequestComplete(Irp, Status, BytesReceived);
+ } else
+ IoMarkIrpPending(Irp);
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
@@ -819,7 +831,8 @@
if (TranContext == NULL)
{
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
- return STATUS_INVALID_ADDRESS;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
/* Initialize a receive request */
@@ -852,11 +865,13 @@
(PDATAGRAM_COMPLETION_ROUTINE)DispDataRequestComplete,
Irp,
Irp);
- if (Status != STATUS_PENDING) {
- DispDataRequestComplete(Irp, Status, BytesReceived);
- } else
- IoMarkIrpPending(Irp);
- }
+ }
+
+done:
+ if (Status != STATUS_PENDING) {
+ DispDataRequestComplete(Irp, Status, BytesReceived);
+ } else
+ IoMarkIrpPending(Irp);
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
@@ -889,13 +904,15 @@
if (TranContext == NULL)
{
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
if (TranContext->Handle.ConnectionContext == NULL)
{
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
- return STATUS_INVALID_CONNECTION;
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
}
Status = DispPrepareIrpForCancel(
@@ -920,12 +937,13 @@
SendInfo->SendFlags,
DispDataRequestComplete,
Irp);
- if (Status != STATUS_PENDING)
- {
- DispDataRequestComplete(Irp, Status, BytesSent);
- } else
- IoMarkIrpPending( Irp );
- }
+ }
+
+done:
+ if (Status != STATUS_PENDING) {
+ DispDataRequestComplete(Irp, Status, 0);
+ } else
+ IoMarkIrpPending(Irp);
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
@@ -954,6 +972,12 @@
IrpSp = IoGetCurrentIrpStackLocation(Irp);
DgramInfo = (PTDI_REQUEST_KERNEL_SENDDG)&(IrpSp->Parameters);
TranContext = IrpSp->FileObject->FsContext;
+ if (TranContext == NULL)
+ {
+ TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
+ Status = STATUS_INVALID_CONNECTION;
+ goto done;
+ }
/* Initialize a send request */
Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
@@ -990,12 +1014,13 @@
&Irp->IoStatus.Information);
else
Status = STATUS_UNSUCCESSFUL;
-
- if (Status != STATUS_PENDING) {
- DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information);
- } else
- IoMarkIrpPending( Irp );
- }
+ }
+
+done:
+ if (Status != STATUS_PENDING) {
+ DispDataRequestComplete(Irp, Status, 0);
+ } else
+ IoMarkIrpPending(Irp);
TI_DbgPrint(DEBUG_IRP, ("Leaving.\n"));