diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 839e1235db05..e60e5e6cc096 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -117,8 +117,10 @@ static inline struct sk_buff *dequeue_head(struct fq_codel_flow *flow) { struct sk_buff *skb = flow->head; - flow->head = skb->next; - skb_mark_not_on_list(skb); + if (skb) { + flow->head = skb->next; + skb_mark_not_on_list(skb); + } return skb; } @@ -166,9 +168,11 @@ static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets, i = 0; do { skb = dequeue_head(flow); - len += qdisc_pkt_len(skb); - mem += get_codel_cb(skb)->mem_usage; - __qdisc_drop(skb, to_free); + if (skb) { + len += qdisc_pkt_len(skb); + mem += get_codel_cb(skb)->mem_usage; + __qdisc_drop(skb, to_free); + } } while (++i < max_packets && len < threshold); /* Tell codel to increase its signal strength also */