Re: [B.A.T.M.A.N.] [PATCH v4 04/31] batman-adv: Avoid recursive call_rcu for batadv_nc_node

Marek Lindner
2016-01-16T04:54:34Z

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

On Tuesday, January 05, 2016 12:06:19 Sven Eckelmann wrote:
> The batadv_nc_node_free_ref function uses call_rcu to delay the free of the
> batadv_nc_node object until no (already started) rcu_read_lock is enabled
> anymore. This makes sure that no context is still trying to access the
> object which should be removed. But batadv_nc_node also contains a
> reference to orig_node which must be removed.
>
> The reference drop of orig_node was done in the call_rcu function
> batadv_nc_node_free_rcu but should actually be done in the
> batadv_nc_node_release function to avoid nested call_rcus. This is
> important because rcu_barrier (e.g. batadv_softif_free or batadv_exit) will
> not detect the inner call_rcu as relevant for its execution. Otherwise this
> barrier will most likely be inserted in the queue before the callback of
> the first call_rcu was executed. The caller of rcu_barrier will therefore
> continue to run before the inner call_rcu callback finished.
>
> Fixes: 3ed7ada3f0bb ("batman-adv: network coding - detect coding nodes and
> remove these after timeout") Signed-off-by: Sven Eckelmann
> <sven@narfation.org>
> ---
> v4:
> - fix function names in commit messages
> - fix double whitespace in batadv_tt_orig_list_entry_release kerneldoc
> - add extra patch for batadv_claim_free_ref kerneldoc fix
> - change the phrase "free it" in all *_free_ref/*_put functions to "release
> it"

Applied in revision 3461a2e.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]