]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Sep 2017 16:34:08 +0000 (09:34 -0700)
commit9435b5f63bdbe5db9b77e983317f9e40f8b2b7e8
tree8c98c50e192e780bfa9d845b4c7e416cb3ae9d3a
parente51754eda781718950988fb0ed7241dc39081db6
net: sched: fix use-after-free in tcf_action_destroy and tcf_del_walker

Recent commit 3c38b47dcdd5 ("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: 1d2f0fe9d59b ("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>
net/sched/act_api.c