提交 18c8d82a 编写于 作者: E Eric Dumazet 提交者: David S. Miller

sfq: fix slot_dequeue_head()

slot_dequeue_head() should make sure slot skb chain is correct in both
ways, or we can crash if all possible flows are in use.

Jarek pointed out slot_queue_init() can now be done in sfq_init() once,
instead each time a flow is setup.
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 eeaeb068
...@@ -297,6 +297,7 @@ static inline struct sk_buff *slot_dequeue_head(struct sfq_slot *slot) ...@@ -297,6 +297,7 @@ static inline struct sk_buff *slot_dequeue_head(struct sfq_slot *slot)
struct sk_buff *skb = slot->skblist_next; struct sk_buff *skb = slot->skblist_next;
slot->skblist_next = skb->next; slot->skblist_next = skb->next;
skb->next->prev = (struct sk_buff *)slot;
skb->next = skb->prev = NULL; skb->next = skb->prev = NULL;
return skb; return skb;
} }
...@@ -380,7 +381,6 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -380,7 +381,6 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
q->ht[hash] = x; q->ht[hash] = x;
slot = &q->slots[x]; slot = &q->slots[x];
slot->hash = hash; slot->hash = hash;
slot_queue_init(slot);
} }
/* If selected queue has length q->limit, do simple tail drop, /* If selected queue has length q->limit, do simple tail drop,
...@@ -545,8 +545,10 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -545,8 +545,10 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
return err; return err;
} }
for (i = 0; i < SFQ_SLOTS; i++) for (i = 0; i < SFQ_SLOTS; i++) {
slot_queue_init(&q->slots[i]);
sfq_link(q, i); sfq_link(q, i);
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册