ASSERT re. unreleased SGDMA resources in checked NDIS.SYS

Hello All.

When unloading my NIC miniport (NDIS 6.2), I’m seeing the following ASSERTS in the checked version of NDIS.SYS:

*** Assertion failed: Ndis: Miniport is going away without releasing all resources.
(Miniport->MiniportSGDmaBlock->DmaAdapterRefCount == 0)
*** Source File: d:\w7rtm\minio\ndis\sys\minint.c, line 1444

Break repeatedly, break Once, Ignore, terminate Process, or terminate Thread (boipt)? i
i

*** Assertion failed: Miniport->MiniportSGDmaBlock == NULL
*** Source File: d:\w7rtm\minio\ndis\sys\ndispnp.c, line 1468

I’ve ensured that I’m freeing the SG DMA handle (obtained via NdisMRegisterScatterGatherDma() ) and that I’m freeing the allocated SG List resources for every TX NBL sent successfully.

Any help/pointers would be highly appreciated.

Thanks!

Well, you’ve leaked something relating to DMA. Although it’s good, of course, to not leak SG lists allocated through NdisMAllocateNetBufferSGList, I believe that that particular bug wouldn’t trigger both those asserts. Here is a list of things you should search your code for, and make sure that allocs are balanced with frees. (From your other post, I know that *you’re* writing a 6.20 miniport, but I’ll include 5.x APIs too for the benefit of others coming in through a search engine). You can also set a breakpoint on each of these (bp ndis!NdisMAllocateSharedMemory “kn 4; gc”) and manually count that they are balanced.

Both 5.x and 6.x miniports:
NdisMRegisterDmaChannel / NdisMDeregisterDmaChannel
NdisMAllocateSharedMemory / NdisMFreeSharedMemory

6.x only:
NdisMRegisterScatterGatherDma / NdisMDeregisterScatterGatherDma
NdisMAllocateSharedMemoryAsyncEx / NdisMFreeSharedMemory
NdisAllocateSharedMemory / NdisFreeSharedMemory

5.x only:
NdisMAllocateSharedMemoryAsync / NdisMFreeSharedMemory
NdisMAllocateMapRegisters / NdisMFreeMapRegisters

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@live.com
Sent: Wednesday, December 01, 2010 5:00 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] ASSERT re. unreleased SGDMA resources in checked NDIS.SYS

Hello All.

When unloading my NIC miniport (NDIS 6.2), I’m seeing the following ASSERTS in the checked version of NDIS.SYS:

*** Assertion failed: Ndis: Miniport is going away without releasing all resources.
(Miniport->MiniportSGDmaBlock->DmaAdapterRefCount == 0)
*** Source File: d:\w7rtm\minio\ndis\sys\minint.c, line 1444

Break repeatedly, break Once, Ignore, terminate Process, or terminate Thread (boipt)? i i

*** Assertion failed: Miniport->MiniportSGDmaBlock == NULL
*** Source File: d:\w7rtm\minio\ndis\sys\ndispnp.c, line 1468

I’ve ensured that I’m freeing the SG DMA handle (obtained via NdisMRegisterScatterGatherDma() ) and that I’m freeing the allocated SG List resources for every TX NBL sent successfully.

Any help/pointers would be highly appreciated.

Thanks!


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi Jeffrey…

Ah… I was planning on implementing some rough’n’ready memory allocation tracking code but the content of the assert message confused me.

But lazy that I am, I’ll try the counting trick first :smiley:

thanks again :slight_smile: