Commit c0f84d0d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

sch_teql: should not dereference skb after ndo_start_xmit()

It is illegal to dereference a skb after a successful ndo_start_xmit()
call. We must store skb length in a local variable instead.

Bug was introduced in 2.6.27 by commit 0abf77e5
(net_sched: Add accessor function for packet length for qdiscs)
Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77527313
...@@ -303,6 +303,8 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -303,6 +303,8 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
switch (teql_resolve(skb, skb_res, slave)) { switch (teql_resolve(skb, skb_res, slave)) {
case 0: case 0:
if (__netif_tx_trylock(slave_txq)) { if (__netif_tx_trylock(slave_txq)) {
unsigned int length = qdisc_pkt_len(skb);
if (!netif_tx_queue_stopped(slave_txq) && if (!netif_tx_queue_stopped(slave_txq) &&
!netif_tx_queue_frozen(slave_txq) && !netif_tx_queue_frozen(slave_txq) &&
slave_ops->ndo_start_xmit(skb, slave) == 0) { slave_ops->ndo_start_xmit(skb, slave) == 0) {
...@@ -310,8 +312,7 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -310,8 +312,7 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
master->slaves = NEXT_SLAVE(q); master->slaves = NEXT_SLAVE(q);
netif_wake_queue(dev); netif_wake_queue(dev);
master->stats.tx_packets++; master->stats.tx_packets++;
master->stats.tx_bytes += master->stats.tx_bytes += length;
qdisc_pkt_len(skb);
return 0; return 0;
} }
__netif_tx_unlock(slave_txq); __netif_tx_unlock(slave_txq);
......
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