dmfe : number of fixes and features
From: Maxim Levitsky <[email protected]>
Subject: [PATCH] [NET] [002] dmfe : Fix possible oops
Deallocate memory after driver is unregistred to prevent oops
Don't dereference NULL pointer that can be returned by dev_alloc_skb in case of oom
Signed-off-by Maxim Levitsky <[email protected]>
---
drivers/net/tulip/dmfe.c +9 -4
@@ -497,13 +497,16 @@ static void __devexit dmfe_remove_one (sDMFE_DBUG (0 ,"dmfe_remove_one()" ,0 );if (dev) { + +unregister_netdev (dev); +pci_release_regions (pdev); + +pci_free_consistent (db->pdev,sizeof (struct tx_desc ) *DESC_ALL_CNT +0x20 , db->desc_pool_ptr, db->desc_pool_dma_ptr);pci_free_consistent (db->pdev,TX_BUF_ALLOC *TX_DESC_CNT +4 , db->buf_pool_ptr, db->buf_pool_dma_ptr); -unregister_netdev (dev); -pci_release_regions (pdev);free_netdev (dev);/* free board information */ pci_set_drvdata (pdev,NULL ); }
@@ -921,7 +924,7 @@ static inline u32 cal_CRC(unsigned charstatic void dmfe_rx_packet (struct DEVICE *dev,struct dmfe_board_info * db) {struct rx_desc *rxptr; -struct sk_buff *skb; +struct sk_buff *skb, *newskb;int rxlen;u32 rdes0;
@@ -974,8 +977,10 @@ static void dmfe_rx_packet(struct DEVICE/* Good packet, send to upper layer */ /* Shorst packet used new SKB */ if ( (rxlen <RX_COPY_SIZE ) && - ( (skb =dev_alloc_skb (rxlen +2 ) ) + ( (newskb =dev_alloc_skb (rxlen +2 ) ) !=NULL ) ) { + + skb = newskb;/* size less than COPY_SIZE, allocate a rxlen SKB */ skb->dev = dev;skb_reserve (skb,2 );/* 16byte align */
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html