From: David Miller <davem@davemloft.net>
To: jeffrey.t.kirsher@intel.com
Cc: netdev@vger.kernel.org, emil.s.tantilov@intel.com
Subject: Re: [BUG] NULL pointer dereference in skb_dequeue
Date: Fri, 01 Aug 2008 18:20:28 -0700 (PDT) [thread overview]
Message-ID: <20080801.182028.74132050.davem@davemloft.net> (raw)
In-Reply-To: <20080801.180337.233358413.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Fri, 01 Aug 2008 18:03:37 -0700 (PDT)
> Looks like two threads are accessing the qdisc SKB lists but one of
> them isn't taking the proper qdisc locks.
>
> I can't see how this can happen currently but I'll try to figure it
> out.
I see what's going on.
Once we decide on a root qdisc to process, we shouldn't use
qdisc_root_lock() since that will resample qdisc->dev_queue->qdisc
which might be different.
This points out a core problem, and I might need to add a
root_qdisc backpointer to struct Qdisc to make this all work
out sanely for all cases.
Anyways, please try this patch:
pkt_sched: Use qdisc_lock() on already sampled root qdisc.
Don't use qdisc_root_lock() in these cases as the root
qdisc could have been changed, and we'd thus lock the
wrong object.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 9c9cd4d..113b6b0 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -29,7 +29,7 @@
/* Main transmission queue. */
/* Modifications to data participating in scheduling must be protected with
- * qdisc_root_lock(qdisc) spinlock.
+ * qdisc_lock(qdisc) spinlock.
*
* The idea is the following:
* - enqueue, dequeue are serialized via qdisc root lock
@@ -126,7 +126,7 @@ static inline int qdisc_restart(struct Qdisc *q)
if (unlikely((skb = dequeue_skb(q)) == NULL))
return 0;
- root_lock = qdisc_root_lock(q);
+ root_lock = qdisc_lock(q);
/* And release qdisc */
spin_unlock(root_lock);
@@ -659,7 +659,7 @@ static bool some_qdisc_is_running(struct net_device *dev, int lock)
dev_queue = netdev_get_tx_queue(dev, i);
q = dev_queue->qdisc;
- root_lock = qdisc_root_lock(q);
+ root_lock = qdisc_lock(q);
if (lock)
spin_lock_bh(root_lock);
next prev parent reply other threads:[~2008-08-02 1:20 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-01 23:40 [BUG] NULL pointer dereference in skb_dequeue Jeff Kirsher
2008-08-02 1:03 ` David Miller
2008-08-02 1:20 ` David Miller [this message]
2008-08-02 9:36 ` Tantilov, Emil S
2008-08-02 13:37 ` Jarek Poplawski
2008-08-02 16:27 ` Jarek Poplawski
2008-08-02 19:18 ` David Miller
2008-08-02 19:22 ` David Miller
2008-08-02 19:45 ` Tantilov, Emil S
2008-08-02 21:46 ` Tantilov, Emil S
2008-08-03 2:26 ` David Miller
2008-08-08 19:38 ` Tantilov, Emil S
2008-08-09 7:29 ` David Miller
2008-08-09 22:32 ` Jarek Poplawski
2008-08-10 19:04 ` Jarek Poplawski
2008-08-11 10:01 ` Jarek Poplawski
2008-08-11 23:26 ` Paul E. McKenney
2008-08-12 6:36 ` Jarek Poplawski
2008-08-12 13:42 ` Paul E. McKenney
2008-08-12 18:09 ` Jarek Poplawski
2008-08-12 20:18 ` Paul E. McKenney
2008-08-12 21:15 ` Jarek Poplawski
2008-08-12 22:33 ` Paul E. McKenney
2008-08-02 20:19 ` Jarek Poplawski
2008-08-03 9:29 ` Jarek Poplawski
2008-08-03 9:50 ` Jarek Poplawski
2008-08-03 9:56 ` David Miller
2008-08-03 10:08 ` Jarek Poplawski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080801.182028.74132050.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=emil.s.tantilov@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).