Commit 33f5782f authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[PKT_SCHED]: Fix q_idx calculation in tc_dump_qdisc.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 251f4c31
...@@ -817,13 +817,16 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -817,13 +817,16 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
read_lock_bh(&qdisc_tree_lock); read_lock_bh(&qdisc_tree_lock);
q_idx = 0; q_idx = 0;
list_for_each_entry(q, &dev->qdisc_list, list) { list_for_each_entry(q, &dev->qdisc_list, list) {
if (q_idx++ < s_q_idx) if (q_idx < s_q_idx) {
q_idx++;
continue; continue;
}
if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid, if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
read_unlock_bh(&qdisc_tree_lock); read_unlock_bh(&qdisc_tree_lock);
goto done; goto done;
} }
q_idx++;
} }
read_unlock_bh(&qdisc_tree_lock); read_unlock_bh(&qdisc_tree_lock);
} }
...@@ -832,7 +835,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -832,7 +835,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
read_unlock(&dev_base_lock); read_unlock(&dev_base_lock);
cb->args[0] = idx; cb->args[0] = idx;
cb->args[1] = q_idx - 1; cb->args[1] = q_idx;
return skb->len; return skb->len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment