KeGetCurrentIrql fails

I have following code fragment in my driver:

if ( KeGetCurrentIrql() <= APC_LEVEL )
{
IoDeleteDevice( DeviceObject ); //bugcheck occurs here
}
else
{
//Queue it to workitem
}

The bugcheck IRQL_NOT_LESS_OR_EQUAL occurs at the IoDeleteDevice.

Bugcheck analysis shows that the IRQL = 00000002.
how could that happen?

Has anyone seen this happening. i.e. KeGetCurrentIrql returning
an incorrect irql or something.

Bugcheck analysis shows, the IRQL as DISPATCH, Please
make sure if u’r symbols are matching.
-Amol.

— Mani wrote:

> I have following code fragment in my driver:
>
> if ( KeGetCurrentIrql() <= APC_LEVEL )
> {
> IoDeleteDevice( DeviceObject ); //bugcheck occurs
> here
> }
> else
> {
> //Queue it to workitem
> }
>
> The bugcheck IRQL_NOT_LESS_OR_EQUAL occurs at the
> IoDeleteDevice.
>
> Bugcheck analysis shows that the IRQL = 00000002.
> how could that happen?
>
> Has anyone seen this happening. i.e.
> KeGetCurrentIrql returning
> an incorrect irql or something.
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

yes. they match.

“Amol Tasgaonkar” wrote in message news:xxxxx@ntfsd…
>
> Bugcheck analysis shows, the IRQL as DISPATCH, Please
> make sure if u’r symbols are matching.
> -Amol.
>
> — Mani wrote:
>
> > I have following code fragment in my driver:
> >
> > if ( KeGetCurrentIrql() <= APC_LEVEL )
> > {
> > IoDeleteDevice( DeviceObject ); //bugcheck occurs
> > here
> > }
> > else
> > {
> > //Queue it to workitem
> > }
> >
> > The bugcheck IRQL_NOT_LESS_OR_EQUAL occurs at the
> > IoDeleteDevice.
> >
> > Bugcheck analysis shows that the IRQL = 00000002.
> > how could that happen?
> >
> > Has anyone seen this happening. i.e.
> > KeGetCurrentIrql returning
> > an incorrect irql or something.
> >
> >
> >
> > —
> > Questions? First check the IFS FAQ at
> > https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

I think the problem is in the DeviceObject , possibly you already called
IoDeleteDevice for it.
IoDeleteDevice acquires spin lock, therefore IRQL is 0x2.

“Mani” wrote in message news:xxxxx@ntfsd…
>I have following code fragment in my driver:
>
> if ( KeGetCurrentIrql() <= APC_LEVEL )
> {
> IoDeleteDevice( DeviceObject ); //bugcheck occurs here
> }
> else
> {
> //Queue it to workitem
> }
>
> The bugcheck IRQL_NOT_LESS_OR_EQUAL occurs at the IoDeleteDevice.
>
> Bugcheck analysis shows that the IRQL = 00000002.
> how could that happen?
>
> Has anyone seen this happening. i.e. KeGetCurrentIrql returning
> an incorrect irql or something.
>
>
>