diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index a37137430e61ecf5dd487bb18ebf05c03d67b60e..1f9d481b0fbbf957f0f2ef3af6ce167256062af6 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -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: