All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net_sched: netem: do not call qdisc_drop() with a NULL skb
@ 2016-06-28  8:30 Eric Dumazet
  2016-06-29 12:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2016-06-28  8:30 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Dan Carpenter

From: Eric Dumazet <edumazet@google.com>

If skb_unshare() fails, we call qdisc_drop() with a NULL skb, which
is no longer supported.

Fixes: 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/sched/sch_netem.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index ccca8ca4c722c603e8b8e6052eead51243e590b5..6eac3d8800480a4c463ae8d3b78a4fcfeec8165b 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -487,10 +487,14 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		skb = segs;
 		segs = segs->next;
 
-		if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
-		    (skb->ip_summed == CHECKSUM_PARTIAL &&
-		     skb_checksum_help(skb))) {
-			rc = qdisc_drop(skb, sch, to_free);
+		skb = skb_unshare(skb, GFP_ATOMIC);
+		if (unlikely(!skb)) {
+			qdisc_qstats_drop(sch);
+			goto finish_segs;
+		}
+		if (skb->ip_summed == CHECKSUM_PARTIAL &&
+		    skb_checksum_help(skb)) {
+			qdisc_drop(skb, sch, to_free);
 			goto finish_segs;
 		}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net_sched: netem: do not call qdisc_drop() with a NULL skb
  2016-06-28  8:30 [PATCH net-next] net_sched: netem: do not call qdisc_drop() with a NULL skb Eric Dumazet
@ 2016-06-29 12:04 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-06-29 12:04 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, dan.carpenter

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 28 Jun 2016 10:30:08 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> If skb_unshare() fails, we call qdisc_drop() with a NULL skb, which
> is no longer supported.
> 
> Fixes: 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-29 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28  8:30 [PATCH net-next] net_sched: netem: do not call qdisc_drop() with a NULL skb Eric Dumazet
2016-06-29 12:04 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.