Thread (7 messages) 7 messages, 4 authors, 2016-01-30

Re: [PATCH] net_sched: drr: check for NULL pointer in drr_dequeue

From: Sergei Shtylyov <hidden>
Date: 2016-01-28 14:04:22
Also in: netdev

Hello.

On 1/28/2016 6:30 AM, Bernie Harris wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
  net/sched/sch_drr.c | 2 ++
  1 file changed, 2 insertions(+)
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index f26bdea..a1cd778 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -403,6 +403,8 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
  		if (len <= cl->deficit) {
  			cl->deficit -= len;
  			skb = qdisc_dequeue_peeked(cl->qdisc);
+			if (unlikely(skb == NULL))
    !skb is preferred in the networking code. I think scripts/checkpatch.pl 
should've warned you.

[...]

MBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help