]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: sched: fix use-after-free in tcf_action_destroy and tcf_del_walker
authorJiri Pirko <jiri@mellanox.com>
Wed, 13 Sep 2017 15:32:37 +0000 (17:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:56:02 +0000 (11:56 +0200)
commit52bf37469dfe3ee800882fe7e5b25d744f8ab242
tree7cbcf582134a63998289408b851b2e0b08768a59
parent953ec9c15dc134ef501a49d201a8e20c655926ef
net: sched: fix use-after-free in tcf_action_destroy and tcf_del_walker

[ Upstream commit 255cd50f207ae8ec7b22663246c833407744e634 ]

Recent commit d7fb60b9cafb ("net_sched: get rid of tcfa_rcu") removed
freeing in call_rcu, which changed already existing hard-to-hit
race condition into 100% hit:

[  598.599825] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
[  598.607782] IP: tcf_action_destroy+0xc0/0x140

Or:

[   40.858924] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
[   40.862840] IP: tcf_generic_walker+0x534/0x820

Fix this by storing the ops and use them directly for module_put call.

Fixes: a85a970af265 ("net_sched: move tc_action into tcf_common")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_api.c