Validating usage of NDIS_HANDLEs in miniports

I’m doing a code review of an NDIS miniport. Without getting stuck on the
issue of *why*, this code stores references to the NDIS_HANDLE passed to
MiniportInitialize, and later invokes NDIS library functions (such as
NdisMIndicateStatus, NdisMEthIndicateReceiveComplete, etc.) in arbitrary
thread contexts. In other words, these NDIS library functions are NOT being
called in the context of miniport/wrapper callbacks, such as MiniportIsr,
etc.

Is this (guaranteed to be) safe? As long as the driver can guarantee that
none of these functions are being called with an adapter context after the
MiniportHalt callback completes, it seems like it should be. But I cannot
find a description, one way or the other, of whether this is acceptable or
not.

Empirically, the driver works, but I am interested in whether it will
continue to work, and under what conditions.

Thanks.

– arlie

Arlie,

Yes it is safe as long as it is a deserialized miniport, and, as you have
intuited, the callbacks cease before the return from MiniportHalt().

I recall that the DDK does still discuss serialized and deserialized
miniport operation to some extent. Perhaps it is covered more fully in
older DDKs (NT4, W2K) when the feature was a bit newer.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Arlie Davis
Sent: Wednesday, August 17, 2005 5:57 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Validating usage of NDIS_HANDLEs in miniports

I’m doing a code review of an NDIS miniport. Without getting stuck on the
issue of *why*, this code stores references to the NDIS_HANDLE passed to
MiniportInitialize, and later invokes NDIS library functions (such as
NdisMIndicateStatus, NdisMEthIndicateReceiveComplete, etc.) in arbitrary
thread contexts. In other words, these NDIS library functions are NOT being
called in the context of miniport/wrapper callbacks, such as MiniportIsr,
etc.

Is this (guaranteed to be) safe? As long as the driver can guarantee that
none of these functions are being called with an adapter context after the
MiniportHalt callback completes, it seems like it should be. But I cannot
find a description, one way or the other, of whether this is acceptable or
not.

Empirically, the driver works, but I am interested in whether it will
continue to work, and under what conditions.

Thanks.

– arlie


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@lists.osr.com