Skip to contentSkip to conversation

de4x5.c: don't reference skb after passing it to netif_rx

PATCH New Arnaldo Carvalho de Melo 1 participant 2 messages Feb 27, 2001 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

drivers/net/de4x5.c +1 -1
@@ -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);
 		}
 	    }
 	    
#1 lore raw

PATCH 1/1 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

drivers/net/defxx.c +1 -2
@@ -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;
 				}
 			}
 			}