Skip to content

Commit

Permalink
CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewige committed Nov 13, 2024
1 parent ded683b commit 8833dc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions netebpfext/net_ebpf_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static bool _net_ebpf_sock_ops_providers_registered = false;
// Global objects used to store filter contexts that are being cleaned up. This is currently only used in debug
// contexts.
EX_SPIN_LOCK _net_ebpf_filter_zombie_list_lock = {0};
static bool _net_ebpf_filter_zombie_list_initialized = false;
static LIST_ENTRY _net_ebpf_filter_zombie_list = {0};
#endif // _DEBUG

Expand Down Expand Up @@ -910,10 +909,7 @@ net_ebpf_ext_register_providers()
_net_ebpf_sock_ops_providers_registered = true;

#ifdef _DEBUG
if (!_net_ebpf_filter_zombie_list_initialized) {
InitializeListHead(&_net_ebpf_filter_zombie_list);
_net_ebpf_filter_zombie_list_initialized = true;
}
InitializeListHead(&_net_ebpf_filter_zombie_list);
#endif // _DEBUG

Exit:
Expand Down Expand Up @@ -1014,15 +1010,15 @@ net_ebpf_ext_remove_client_context(

#ifdef _DEBUG
void
net_ebpf_ext_add_filter_context_to_zombie_list(_In_ net_ebpf_extension_wfp_filter_context_t* filter_context)
net_ebpf_ext_add_filter_context_to_zombie_list(_Inout_ net_ebpf_extension_wfp_filter_context_t* filter_context)
{
KIRQL old_irql = ExAcquireSpinLockExclusive(&_net_ebpf_filter_zombie_list_lock);
InsertHeadList(&_net_ebpf_filter_zombie_list, &filter_context->link);
ExReleaseSpinLockExclusive(&_net_ebpf_filter_zombie_list_lock, old_irql);
}

void
net_ebpf_ext_remove_filter_context_from_zombie_list(_In_ net_ebpf_extension_wfp_filter_context_t* filter_context)
net_ebpf_ext_remove_filter_context_from_zombie_list(_Inout_ net_ebpf_extension_wfp_filter_context_t* filter_context)
{
if (!IsListEmpty(&filter_context->link)) {
KIRQL old_irql = ExAcquireSpinLockExclusive(&_net_ebpf_filter_zombie_list_lock);
Expand Down
4 changes: 2 additions & 2 deletions netebpfext/net_ebpf_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,13 @@ net_ebpf_ext_add_client_context(
* @param filter_context Filter context to add to the zombie list.
*/
void
net_ebpf_ext_add_filter_context_to_zombie_list(_In_ net_ebpf_extension_wfp_filter_context_t* filter_context);
net_ebpf_ext_add_filter_context_to_zombie_list(_Inout_ net_ebpf_extension_wfp_filter_context_t* filter_context);

/**
* @brief Remove the filter context from the zombie list.
*
* @param filter_context Filter context to remove from the zombie list.
*/
void
net_ebpf_ext_remove_filter_context_from_zombie_list(_In_ net_ebpf_extension_wfp_filter_context_t* filter_context);
net_ebpf_ext_remove_filter_context_from_zombie_list(_Inout_ net_ebpf_extension_wfp_filter_context_t* filter_context);
#endif // _DEBUG

0 comments on commit 8833dc5

Please sign in to comment.