net: sched: cgroup: verify that filter is not NULL during walk

Check that filter is not NULL before passing it to tcf_walker->fn()
callback in cls_cgroup_walk(). This can happen when cls_cgroup_change()
failed to set first filter.

Fixes: ed76f5edcc ("net: sched: protect filter_chain list with filter_chain_lock mutex")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vlad Buslov 2019-02-15 17:18:44 +02:00 committed by David S. Miller
parent d66022cd16
commit 8b58d12f4a
1 changed files with 2 additions and 0 deletions

View File

@ -158,6 +158,8 @@ static void cls_cgroup_walk(struct tcf_proto *tp, struct tcf_walker *arg,
if (arg->count < arg->skip)
goto skip;
if (!head)
return;
if (arg->fn(tp, head, arg) < 0) {
arg->stop = 1;
return;