]> 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)
commit60ec4616d58a7a694cb33112a1332fa5b55aa752
tree2d297adc23f02d83091414deb0defe56b903372a
parent5d60c23390a0032cf845eb876e2e10a08e265437
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