]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerJiri Slaby <jslaby@suse.cz>
Thu, 3 Mar 2016 11:45:58 +0000 (12:45 +0100)
commit9b2239e264e282b4cc802f8abe529c61d48fad1d
treec13874eedf6670058449a25b724cae4d79fdaf93
parent8c4cb2a75a22b5720342899496123c4c78939640
mac80211: mesh: fix call_rcu() usage

commit c2e703a55245bfff3db53b1f7cbe59f1ee8a4339 upstream.

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.

Fixes: eb2b9311fd00 ("mac80211: mesh path table implementation")
Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
net/mac80211/mesh_pathtbl.c