OSDN Git Service

net: sched: matchall: verify that filter is not NULL in mall_walk()
authorVlad Buslov <vladbu@mellanox.com>
Fri, 15 Feb 2019 15:17:56 +0000 (17:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Feb 2019 21:26:39 +0000 (13:26 -0800)
Check that filter is not NULL before passing it to tcf_walker->fn()
callback. This can happen when mall_change() failed to offload filter to
hardware.

Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex")
Reported-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_matchall.c

index a371374..1f9d481 100644 (file)
@@ -247,6 +247,9 @@ static void mall_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;
 skip: