]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: sched: cgroup: verify that filter is not NULL during walk
authorVlad Buslov <vladbu@mellanox.com>
Fri, 15 Feb 2019 15:18:44 +0000 (17:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Feb 2019 21:26:57 +0000 (13:26 -0800)
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: ed76f5edccc9 ("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>
net/sched/cls_cgroup.c

index 1cef3b41609405a535094e4faeec3609d0219ff4..02b05066b63549526dc6ac2cc7275ac6d0f615c8 100644 (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;