memory modified after free / taskq node_alloc/free{_cb} #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are cases when node_alloc() and node_free() are called but
the node_alloc_cd() has not run yet. This can lead to node_free()
freeing the *ni before the node_alloc_cb() runs which then modifies
memory (in this case the "is_in_peer_table") after free (in
addition to inserting state which is wrong).
To address this do multiple things:
and use a macro and ath10k_dbg() to track state changes. This was
mostly for debugging.
not used anywhere outside the function. Helps understanding the
code.
so we can check it during node_free() and cancel the callback if
needed.
the entry: ad d a second list where we put the entries we are
executing. Walking that list can be done lock-less. Add a
athp_taskq_cancel() function which will either take the entry
of the taskq or wait that no entries are run before returning.
While there, remove extra () around the locking macros, remove
an early (extra) on_queue = 1 in athp_taskq_queue() and fold
some print lines into less vertical space.
Fixes Issue #28.
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")