Browse Source

net_sched: drr: check for NULL pointer in drr_dequeue

There are cases where qdisc_dequeue_peeked can return NULL, and the result
is dereferenced later on in the function.

Similarly to the other qdisc dequeue functions, check whether the skb
pointer is NULL and if it is, goto out.

Signed-off-by: Bernie Harris <bernie.harris@alliedtelesis.co.nz>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Bernie Harris 9 years ago
parent
commit
df3eb6cd68
1 changed files with 2 additions and 0 deletions
  1. 2 0
      net/sched/sch_drr.c

+ 2 - 0
net/sched/sch_drr.c

@@ -403,6 +403,8 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
 		if (len <= cl->deficit) {
 		if (len <= cl->deficit) {
 			cl->deficit -= len;
 			cl->deficit -= len;
 			skb = qdisc_dequeue_peeked(cl->qdisc);
 			skb = qdisc_dequeue_peeked(cl->qdisc);
+			if (unlikely(skb == NULL))
+				goto out;
 			if (cl->qdisc->q.qlen == 0)
 			if (cl->qdisc->q.qlen == 0)
 				list_del(&cl->alist);
 				list_del(&cl->alist);