* [PATCH net-next] net: sched: avoid writing on noop_qdisc
@ 2018-10-09 22:20 Eric Dumazet
2018-10-11 5:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2018-10-09 22:20 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, John Fastabend, Eric Dumazet, Eric Dumazet
While noop_qdisc.gso_skb and noop_qdisc.skb_bad_txq are not used
in other places, it seems not correct to overwrite their fields
in dev_init_scheduler_queue().
noop_qdisc is essentially a shared and read-only object, even if
it is not marked as const because of some implementation detail.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/sched/sch_generic.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 3023929852e8c4aaa4172861d2d0beff17e25f27..de1663f7d3ad6e2c06cd2e031036cef5979366a5 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -572,6 +572,18 @@ struct Qdisc noop_qdisc = {
.dev_queue = &noop_netdev_queue,
.running = SEQCNT_ZERO(noop_qdisc.running),
.busylock = __SPIN_LOCK_UNLOCKED(noop_qdisc.busylock),
+ .gso_skb = {
+ .next = (struct sk_buff *)&noop_qdisc.gso_skb,
+ .prev = (struct sk_buff *)&noop_qdisc.gso_skb,
+ .qlen = 0,
+ .lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.gso_skb.lock),
+ },
+ .skb_bad_txq = {
+ .next = (struct sk_buff *)&noop_qdisc.skb_bad_txq,
+ .prev = (struct sk_buff *)&noop_qdisc.skb_bad_txq,
+ .qlen = 0,
+ .lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.skb_bad_txq.lock),
+ },
};
EXPORT_SYMBOL(noop_qdisc);
@@ -1273,8 +1285,6 @@ static void dev_init_scheduler_queue(struct net_device *dev,
rcu_assign_pointer(dev_queue->qdisc, qdisc);
dev_queue->qdisc_sleeping = qdisc;
- __skb_queue_head_init(&qdisc->gso_skb);
- __skb_queue_head_init(&qdisc->skb_bad_txq);
}
void dev_init_scheduler(struct net_device *dev)
--
2.19.0.605.g01d371f741-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: sched: avoid writing on noop_qdisc
2018-10-09 22:20 [PATCH net-next] net: sched: avoid writing on noop_qdisc Eric Dumazet
@ 2018-10-11 5:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-10-11 5:49 UTC (permalink / raw)
To: edumazet; +Cc: netdev, john.fastabend, eric.dumazet
From: Eric Dumazet <edumazet@google.com>
Date: Tue, 9 Oct 2018 15:20:50 -0700
> While noop_qdisc.gso_skb and noop_qdisc.skb_bad_txq are not used
> in other places, it seems not correct to overwrite their fields
> in dev_init_scheduler_queue().
>
> noop_qdisc is essentially a shared and read-only object, even if
> it is not marked as const because of some implementation detail.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-11 13:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 22:20 [PATCH net-next] net: sched: avoid writing on noop_qdisc Eric Dumazet
2018-10-11 5:49 ` 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.