Re: [PATCH v3 08/11] net: sched: don't release reference on action overwrite

Jiri Pirko
2018-05-28T14:28:03Z

Sun, May 27, 2018 at 11:17:26PM CEST, vladbu@mellanox.com wrote:
>Return from action init function with reference to action taken,
>even when overwriting existing action.
>
>Action init API initializes its fourth argument (pointer to pointer to tc
>action) to either existing action with same index or newly created action.
>In case of existing index(and bind argument is zero), init function returns
>without incrementing action reference counter. Caller of action init then
>proceeds working with action, without actually holding reference to it.
>This means that action could be deleted concurrently.
>
>Change action init behavior to always take reference to action before
>returning successfully, in order to protect from concurrent deletion.
>
>Signed-off-by: Vlad Buslov <vladbu@mellanox.com>

Signed-off-by: Jiri Pirko <jiri@mellanox.com>