]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: sched: protect filter_chain list with filter_chain_lock mutex
authorVlad Buslov <vladbu@mellanox.com>
Mon, 11 Feb 2019 08:55:38 +0000 (10:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 18:41:32 +0000 (13:41 -0500)
commited76f5edccc98fa66f2337f0b3b255d6e1a568b7
tree408b13681d6f13914e70783a7d345a560242a219
parenta5654820bb4b1f5f21eb83b8fb9de79ce1382d2b
net: sched: protect filter_chain list with filter_chain_lock mutex

Extend tcf_chain with new filter_chain_lock mutex. Always lock the chain
when accessing filter_chain list, instead of relying on rtnl lock.
Dereference filter_chain with tcf_chain_dereference() lockdep macro to
verify that all users of chain_list have the lock taken.

Rearrange tp insert/remove code in tc_new_tfilter/tc_del_tfilter to execute
all necessary code while holding chain lock in order to prevent
invalidation of chain_info structure by potential concurrent change. This
also serializes calls to tcf_chain0_head_change(), which allows head change
callbacks to rely on filter_chain_lock for synchronization instead of rtnl
mutex.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h
net/sched/cls_api.c
net/sched/sch_generic.c