Driver verifer bug check (0xC4,0x13A)

Hi All,

My virtual stor miniport driver is allocating memory by using following function :

void allocatemem(size)
{
buf = ExAllocatePoolWithTag(NonPagedPool,size, 0x30303030);
if (buf) {
atomic_inc(&alloc_count);
RtlZeroMemory(buf, size);
}

return buf;
}

and freeing it by using :
void kfree(void *addr)
{

ExFreePool((PVOID)addr, 0x30303030); //Got Driver verfier BSOD here…
atomic_dec(&alloc_count);
}

when i run it with driver verifier with the “special pool tracking” ,“pool tracking” “force IRQL checking” "DMA verification options ,got a bugcheck 0xC4 with the sub code 0x13A saying that “ExFreePool” is the faulty code statement.Can any one please help me to find the potential reasons for this.

Thanks in advance,

> and freeing it by using :

void kfree(void *addr)
{

ExFreePool((PVOID)addr, 0x30303030); //Got Driver verfier BSOD
here…
atomic_dec(&alloc_count);
}

Is that really a cut & paste of your code? ExFreePool takes a single
parameter. You should have received a compiler warning/error for that
though so maybe your code really is using ExFreePoolWithTag?

If not, the debugger should tell you where you are freeing the memory,
I’d work backwards from there if I were you.

James

Hi James,

Its not a cut and paste of my code…infact as a part of fix this issue…i tried to free with ExFreepool and ExFreePoolwithTag…but that did not helped me…infact in the code snippet,its a tag being used for ExFreePoolwithTag…

Thanks,