]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: protect chain template accesses with block lock
authorVlad Buslov <vladbu@mellanox.com>
Mon, 11 Feb 2019 08:55:37 +0000 (10:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 18:41:32 +0000 (13:41 -0500)
commit43942584d636da8c7184539afa2f8840ef5d5b29
tree2d297adc23f02d83091414deb0defe56b903372a
parent741ea8fb34c974bea91295856658a0966aad75e5
net: sched: protect chain template accesses with block lock

When cls API is called without protection of rtnl lock, parallel
modification of chain is possible, which means that chain template can be
changed concurrently in certain circumstances. For example, when chain is
'deleted' by new user-space chain API, the chain might continue to be used
if it is referenced by actions, and can be 're-created' again by user. In
such case same chain structure is reused and its template is changed. To
protect from described scenario, cache chain template while holding block
lock. Introduce standalone tc_chain_notify_delete() function that works
with cached template values, instead of chains themselves.

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