Files
linux/net/ipv4
Liping Zhang 146561a3f1 netfilter: invoke synchronize_rcu after set the _hook_ to NULL
[ Upstream commit 3b7dabf029 ]

Otherwise, another CPU may access the invalid pointer. For example:
    CPU0                CPU1
     -              rcu_read_lock();
     -              pfunc = _hook_;
  _hook_ = NULL;          -
  mod unload              -
     -                 pfunc(); // invalid, panic
     -             rcu_read_unlock();

So we must call synchronize_rcu() to wait the rcu reader to finish.

Also note, in nf_nat_snmp_basic_fini, synchronize_rcu() will be invoked
by later nf_conntrack_helper_unregister, but I'm inclined to add a
explicit synchronize_rcu after set the nf_nat_snmp_hook to NULL. Depend
on such obscure assumptions is not a good idea.

Last, in nfnetlink_cttimeout, we use kfree_rcu to free the time object,
so in cttimeout_exit, invoking rcu_barrier() is not necessary at all,
remove it too.

Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-08 10:26:09 +02:00
..
2015-08-25 13:38:50 -07:00
2017-06-17 06:41:50 +02:00
2016-10-20 14:32:22 -04:00
2016-10-20 14:32:22 -04:00
2016-09-21 00:23:01 -04:00
2017-05-03 08:36:34 -07:00
2017-08-30 10:21:40 +02:00
2017-03-22 12:43:34 +01:00
2017-05-14 14:00:21 +02:00
2016-09-01 14:09:01 -07:00
2016-06-10 23:07:49 -07:00
2017-06-17 06:41:49 +02:00
2016-09-21 00:23:00 -04:00
2015-09-17 17:18:37 -07:00
2013-05-31 17:19:05 -07:00