Crash while completing IRP from bus driver

Hi,
We have been working with drivers for WHQL certification.
Starting with a brief description of our driver stack-

Our driver stack has three drivers. 1) MMP 2) MOM 3) MIC

MMP acts as a bus driver and enumerates MOM and MIC.

None of the above drivers support WMI.

But when Driver Verifier is enabled for verification of these
drivers, IRP_MJ_SYSTEM_CONTROL with minor code as IRP_MN_BOGUS is sent by
Driver Verifier to all these drivers.

MMP as an fdo is passing it down when an IRP is sent to it. But
when MOM, MIC are loaded by MMP, IRP_MJ_SYSTEM_CONTROL will be received by
them. They will pass it down to MMP which completes the IRP with status as
STATUS_NOT_SUPPORTED.

I hope this is a correct behaviour expected out of a bus driver.

*At times*, after completion of the IRP by MMP, we are
observing a bug check. The description of the same is as follows

Error = 50 <page_fault_in nonpaged_area> P1 = FF6AFF40; P2 = 0; P3 =
F622F8F8; P4 = 0

This is seen specifically on Windows XP alone and behaviour is
not consistent.
We are testing the same set of drivers in Windows 2000, but this bugcheck
is not seen in Windows 2000.

I have even tried completing the IRP from bus driver without changing the
status
value. But the same crash occurs. Should i use any other status value to
complete the IRP.

The following is the dispatch routine for handling IRP_MJ_SYSTEM_CONTROL

NTSTATUS MmpSystemControl(
IN PDEVICE_OBJECT PDevObj,
IN PIRP PIrp)
/++

Routine Description:
MMP System Control routine

Arguments:
PDEVICE_OBJECT
PIRP

Return Value:
NTSTATUS.

/

{
PSERIAL_DEVICE_EXTENSION pDevExt = GET_SERIAL_DEV_EXT_PTR(PDevObj);
PDEVICE_OBJECT pLowerDevObj = pDevExt->LowerDeviceObject;
NTSTATUS status;
PCOMMON_DEVICE_DATA commonData;

/*
Lock Pages Added for the WMI IRP Handling
*/
SerialLockPagableSectionByHandle(SerialGlobals.PAGESER_Handle);

PAGED_CODE();

commonData = (PCOMMON_DEVICE_DATA) PDevObj->DeviceExtension;

//
// If the device has been removed, the driver should
// not pass the IRP down to the next lower driver.
//

if (commonData->isFDO)
{
//IRP is being sent directly to MMP from PNP manager…
// so pass it down
IoSkipCurrentIrpStackLocation(PIrp);
status = IoCallDriver(pLowerDevObj, PIrp);
}
else
{
// IRP is passed down by MOM or MIC to MMP.
// Now act as a bus driver…and complete the IRP
PIrp->IoStatus.Status = status = STATUS_NOT_SUPPORTED;

IoCompleteRequest (PIrp, IO_NO_INCREMENT);
}

SerialUnlockPagableImageSection(SerialGlobals.PAGESER_Handle);
return status;
}

Thanx in advance
D.Nagarajan.

**********************************************************************************************************************************************

Disclaimer:

This document is intended for transmission to the named recipient only. If
you are not that person, you should note that legal rights reside in this
document and you are not authorized to access, read, disclose, copy, use or
otherwise deal with it and any such actions are prohibited and may be
unlawful. The views expressed in this document are not necessarily those of
HCL Technologies Ltd. Notice is hereby given that no representation,
contract or other binding obligation shall be created by this e-mail, which
must be interpreted accordingly. Any representations, contractual rights or
obligations shall be separately communicated in writing and signed in the
original by a duly authorized officer of the relevant company.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</page_fault_in>

Well this is a bit undocumented, isn’t it? As far as I can tell, the only
documentation for how to handle an unsupported wmi request in a PDO is the
toaster driver function Bus_SystemControl which does the following:

if (!commonData->IsFDO) {
//
// The PDO, just complete the request with the current status
//
Bus_KdPrint (commonData, BUS_DBG_WMI_TRACE,
(“PDO %s\n”, WMIMinorFunctionString(stack->MinorFunction)));
status = Irp->IoStatus.Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return status;
}

I have no idea if the trick with “status = Irp->IoStatus.Status” is
documented, or if it matters. I do think it is ugly. If using exactly this
method doesn’t work against verifier, I would file a bug report with
microsoft and ask for an exemption on the whql test. By the way, you might
want to turn off the paging bits in your driver and see if that matters.

Wmi, can’t live with 'em, can’t live without 'em.

-----Original Message-----
From: xxxxx@yahoo.com [mailto:xxxxx@yahoo.com]
Sent: Monday, February 18, 2002 1:17 AM
To: NT Developers Interest List
Subject: [ntdev] Crash while completing IRP from bus driver

Hi,
We have been working with drivers for WHQL certification.
Starting with a brief description of our driver stack-

Our driver stack has three drivers. 1) MMP 2) MOM 3) MIC

MMP acts as a bus driver and enumerates MOM and MIC.

None of the above drivers support WMI.

But when Driver Verifier is enabled for
verification of these
drivers, IRP_MJ_SYSTEM_CONTROL with minor code as
IRP_MN_BOGUS is sent by
Driver Verifier to all these drivers.

MMP as an fdo is passing it down when an IRP is
sent to it. But
when MOM, MIC are loaded by MMP, IRP_MJ_SYSTEM_CONTROL will
be received by
them. They will pass it down to MMP which completes the IRP
with status as
STATUS_NOT_SUPPORTED.

I hope this is a correct behaviour expected out
of a bus driver.

*At times*, after completion of the IRP by MMP, we are
observing a bug check. The description of the same is as follows

Error = 50 <page_fault_in nonpaged_area> P1 = FF6AFF40; P2 = 0; P3 =
> F622F8F8; P4 = 0
>
> This is seen specifically on Windows XP alone and
> behaviour is
> not consistent.
> We are testing the same set of drivers in Windows 2000, but
> this bugcheck
> is not seen in Windows 2000.
>
> I have even tried completing the IRP from bus
> driver without changing the
> status
> value. But the same crash occurs. Should i use any other
> status value to
> complete the IRP.
>
> The following is the dispatch routine for handling
> IRP_MJ_SYSTEM_CONTROL
>
> NTSTATUS MmpSystemControl(
> IN
> PDEVICE_OBJECT PDevObj,
> IN PIRP PIrp)
> /++
>
> Routine Description:
> MMP System Control routine
>
> Arguments:
> PDEVICE_OBJECT
> PIRP
>
> Return Value:
> NTSTATUS.
>
>
> –
/
>
> {
> PSERIAL_DEVICE_EXTENSION pDevExt = GET_SERIAL_DEV_EXT_PTR(PDevObj);
> PDEVICE_OBJECT pLowerDevObj = pDevExt->LowerDeviceObject;
> NTSTATUS status;
> PCOMMON_DEVICE_DATA commonData;
>
> /*
> Lock Pages Added for the WMI IRP Handling
> */
> SerialLockPagableSectionByHandle(SerialGlobals.PAGESER_Handle);
>
> PAGED_CODE();
>
> commonData = (PCOMMON_DEVICE_DATA) PDevObj->DeviceExtension;
>
> //
> // If the device has been removed, the driver should
> // not pass the IRP down to the next lower driver.
> //
>
> if (commonData->isFDO)
> {
> //IRP is being sent directly to MMP from PNP manager…
> // so pass it down
> IoSkipCurrentIrpStackLocation(PIrp);
> status = IoCallDriver(pLowerDevObj, PIrp);
> }
> else
> {
> // IRP is passed down by MOM or MIC to MMP.
> // Now act as a bus driver…and complete the IRP
> PIrp->IoStatus.Status = status = STATUS_NOT_SUPPORTED;
>
> IoCompleteRequest (PIrp, IO_NO_INCREMENT);
> }
>
> SerialUnlockPagableImageSection(SerialGlobals.PAGESER_Handle);
> return status;
> }
>
>
>
> Thanx in advance
> D.Nagarajan.
>
>
>

> ******************
>
> Disclaimer:
>
> This document is intended for transmission to the named
> recipient only. If
> you are not that person, you should note that legal rights
> reside in this
> document and you are not authorized to access, read,
> disclose, copy, use or
> otherwise deal with it and any such actions are prohibited and may be
> unlawful. The views expressed in this document are not
> necessarily those of
> HCL Technologies Ltd. Notice is hereby given that no representation,
> contract or other binding obligation shall be created by this
> e-mail, which
> must be interpreted accordingly. Any representations,
> contractual rights or
> obligations shall be separately communicated in writing and
> signed in the
> original by a duly authorized officer of the relevant company.
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@stratus.com To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</page_fault_in>