- Yes. For filter drivers, when
NDIS_RECEIVE_FLAGS_RESOURCESis set onFilterReceiveNetBufferLists, restoring the originalNET_BUFFER_LISTlinked list before returning is a documented requirement.
The filter-driver documentation states that when this flag is set, the filter driver cannot keep the NET_BUFFER_LIST structures and underlying driver-allocated resources, should return as quickly as possible, and must retain the original set of NET_BUFFER_LIST structures in the linked list. It explicitly gives the case where a driver processes or indicates them one at a time, but before the function returns, it must restore the original linked list.
- The sanctioned patterns supported by the documentation are:
- If
NDIS_RECEIVE_FLAGS_RESOURCESis set and only part of the traffic is to be passed upward, process or indicate as needed, but restore the original linked list before returning. - If the filter needs to keep data for later processing, copy the data into filter-driver-allocated storage before returning.
- The filter can also copy the buffer and originate a receive indication with the copy; in that case, the original buffer must be returned to the underlying driver.
So for a partial-chain scenario on a RESOURCES indication, the documented safe approaches are:
- temporarily split/process/indicate, then restore the original chain before return, or
- copy the data and use filter-owned storage / a filter-originated indication.
- The available documentation supports only this conclusion: the sample would not need chain-restore handling if it does not alter the original linked list. The documentation makes the restore requirement conditional on the case where the driver has processed or indicated the structures in a way that changes the original list shape. No context states that the obligation is waived for samples.
- No documented runtime self-check or Driver Verifier receive-path rule for this specific condition is present in the provided material.
What is documented is the ownership model:
- If
NDIS_RECEIVE_FLAGS_RESOURCESis not set, the filter retains ownership until it callsNdisFReturnNetBufferLists. - If
NDIS_RECEIVE_FLAGS_RESOURCESis set, returning fromFilterReceiveNetBufferListsreturns the buffer; the filter cannot keep the originalNET_BUFFER_LISTand associated resources. - If a filter calls
NdisFIndicateReceiveNetBufferListswith the resources flag set, NDIS returns theNET_BUFFER_LISTstructures to the filter immediately on return fromNdisFIndicateReceiveNetBufferLists, and NDIS does not callFilterReturnNetBufferListsfor them.
That matches the failure mode described: detaching a branch and returning on a RESOURCES indication breaks the underlying owner’s ability to reclaim all originally indicated NBLs.
On the reference-page question: the FILTER_RECEIVE_NET_BUFFER_LISTS callback remarks do repeat the requirement. They state that if NDIS_RECEIVE_FLAGS_RESOURCES is set, the filter cannot keep the NET_BUFFER_LIST and associated resources, and the note says the driver must retain the original set of NET_BUFFER_LIST structures in the linked list and restore the original linked list before returning.
References: