Commit f16f29b7 authored by François Romieu's avatar François Romieu Committed by Stephen Hemminger

[PATCH] 2.6.3 - drivers/net/sis190.c - Tx desc overflow

Tx descriptor overflow - take II.

Assume tp->dirty_tx = NUM_TX_DESC/2, tp->cur_tx = NUM_TX_DESC - 1,
watch "entry" go beyond NUM_TX_DESC. Actually this is where the same
bug in r8169 driver comes from.
parent 714da829
...@@ -954,8 +954,7 @@ static void ...@@ -954,8 +954,7 @@ static void
SiS190_tx_interrupt(struct net_device *dev, struct sis190_private *tp, SiS190_tx_interrupt(struct net_device *dev, struct sis190_private *tp,
void *ioaddr) void *ioaddr)
{ {
unsigned long dirty_tx, tx_left = 0; unsigned long dirty_tx, tx_left;
int entry = tp->cur_tx % NUM_TX_DESC;
assert(dev != NULL); assert(dev != NULL);
assert(tp != NULL); assert(tp != NULL);
...@@ -965,6 +964,8 @@ SiS190_tx_interrupt(struct net_device *dev, struct sis190_private *tp, ...@@ -965,6 +964,8 @@ SiS190_tx_interrupt(struct net_device *dev, struct sis190_private *tp,
tx_left = tp->cur_tx - dirty_tx; tx_left = tp->cur_tx - dirty_tx;
while (tx_left > 0) { while (tx_left > 0) {
int entry = dirty_tx % NUM_TX_DESC;
if ((le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit) == 0) { if ((le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit) == 0) {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -980,7 +981,6 @@ SiS190_tx_interrupt(struct net_device *dev, struct sis190_private *tp, ...@@ -980,7 +981,6 @@ SiS190_tx_interrupt(struct net_device *dev, struct sis190_private *tp,
tp->stats.tx_packets++; tp->stats.tx_packets++;
dirty_tx++; dirty_tx++;
tx_left--; tx_left--;
entry++;
} }
} }
......
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