]> git.baikalelectronics.ru Git - kernel.git/commit
mac80211: mesh: fix call_rcu() usage
authorJohannes Berg <johannes.berg@intel.com>
Tue, 17 Nov 2015 13:25:21 +0000 (14:25 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 17 Nov 2015 14:49:25 +0000 (15:49 +0100)
commit86417588e75c79f577a135311839209286ba0e8c
tree99b32f45dd6476c616c95379a80abf6d85aefc23
parenta9f13a348af2265619b20301687b74e937bdfd7a
mac80211: mesh: fix call_rcu() usage

When using call_rcu(), the called function may be delayed quite
significantly, and without a matching rcu_barrier() there's no
way to be sure it has finished.
Therefore, global state that could be gone/freed/reused should
never be touched in the callback.

Fix this in mesh by moving the atomic_dec() into the caller;
that's not really a problem since we already unlinked the path
and it will be destroyed anyway.

This fixes a crash Jouni observed when running certain tests in
a certain order, in which the mesh interface was torn down, the
memory reused for a function pointer (work struct) and running
that then crashed since the pointer had been decremented by 1,
resulting in an invalid instruction byte stream.

Cc: stable@vger.kernel.org
Fixes: 34b92b63ebeb ("mac80211: mesh path table implementation")
Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mesh_pathtbl.c