]> git.proxmox.com Git - mirror_ubuntu-focal-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)
commit3f7c72bc4227b169ba2c924a7987324e24bbc4b2
treee7f4629275f0a29d10c25af239f9d4366435f1ec
parent789871bb2a0381425b106d2a995bde1460d35a34
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