2001-02-27 01:13:41

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH] de4x5.c: don't reference skb after passing it to netif_rx

Hi,

I've just read davem's post at netdev about the brokeness of
referencing skbs after passing it to netif_rx, so please consider applying
this patch. Ah, this was just added to the Janitor's TODO list at
http://bazar.conectiva.com.br/~acme/TODO and I'm doing a quick audit in the
net drivers searching for this, maybe some more patches will follow.

- Arnaldo

--- linux-2.4.2/drivers/net/de4x5.c Fri Feb 9 17:40:02 2001
+++ linux-2.4.2.acme/drivers/net/de4x5.c Mon Feb 26 22:02:50 2001
@@ -1731,13 +1731,13 @@

/* Push up the protocol stack */
skb->protocol=eth_type_trans(skb,dev);
+ de4x5_local_stats(dev, skb->data, pkt_len);
netif_rx(skb);

/* Update stats */
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += pkt_len;
- de4x5_local_stats(dev, skb->data, pkt_len);
}
}


2001-02-27 01:18:32

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH] defxx.c: don't reference skb after passing it to netif_rx

one more.

Em Mon, Feb 26, 2001 at 08:33:59PM -0300, Arnaldo Carvalho de Melo escreveu:
Hi,

I've just read davem's post at netdev about the brokeness of
referencing skbs after passing it to netif_rx, so please consider applying
this patch. Ah, this was just added to the Janitor's TODO list at
http://bazar.conectiva.com.br/~acme/TODO and I'm doing a quick audit in the
net drivers searching for this, maybe some more patches will follow.

- Arnaldo

--- linux-2.4.2/drivers/net/defxx.c Tue Feb 13 19:15:05 2001
+++ linux-2.4.2.acme/drivers/net/defxx.c Mon Feb 26 22:09:29 2001
@@ -2858,6 +2858,7 @@
skb->dev = bp->dev; /* pass up device pointer */

skb->protocol = fddi_type_trans(skb, bp->dev);
+ bp->rcv_total_bytes += skb->len;
netif_rx(skb);

/* Update the rcv counters */
@@ -2865,8 +2866,6 @@
bp->rcv_total_frames++;
if (*(p_buff + RCV_BUFF_K_DA) & 0x01)
bp->rcv_multicast_frames++;
-
- bp->rcv_total_bytes += skb->len;
}
}
}