]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: always take reference to action
authorVlad Buslov <vladbu@mellanox.com>
Thu, 5 Jul 2018 14:24:26 +0000 (17:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Jul 2018 03:42:28 +0000 (12:42 +0900)
commit723e573e234b6f8b195ef8393fc2541a34b239b5
treee7f4629275f0a29d10c25af239f9d4366435f1ec
parent1ccc943ce8cb8d65eabc2591ab79e72cd5bb52b4
net: sched: always take reference to action

Without rtnl lock protection it is no longer safe to use pointer to tc
action without holding reference to it. (it can be destroyed concurrently)

Remove unsafe action idr lookup function. Instead of it, implement safe tcf
idr check function that atomically looks up action in idr and increments
its reference and bind counters. Implement both action search and check
using new safe function

Reference taken by idr check is temporal and should not be accounted by
userspace clients (both logically and to preserver current API behavior).
Subtract temporal reference when dumping action to userspace using existing
tca_get_fill function arguments.

Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_api.c