From: Maxim <maximlevitsky@gmail.com>
To: netdev@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.20 002/005] [RESEND v2] dmfe : Fix two bugs
Date: Thu, 15 Feb 2007 23:04:03 +0200 [thread overview]
Message-ID: <200702152304.03835.maximlevitsky@gmail.com> (raw)
In-Reply-To: <200702152253.53680.maximlevitsky@gmail.com>
From: Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 2.6.20 002/005] [RESEND v2] dmfe : Fix two bugs
Fix a oops on module removal due to deallocating memory before unregistring driver
Fix a NULL pointer dereference when dev_alloc_skb fails
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c 2007-02-15 17:59:33.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c 2007-02-15 18:00:14.000000000 +0200
@@ -501,14 +501,17 @@ static void __devexit dmfe_remove_one (s
DMFE_DBUG(0, "dmfe_remove_one()", 0);
if (dev) {
+
+ unregister_netdev(dev);
+
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);
}
@@ -927,7 +930,7 @@ static inline u32 cal_CRC(unsigned char
static 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;
@@ -981,8 +984,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 */
next prev parent reply other threads:[~2007-02-15 21:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-15 20:53 [PATCH 2.6.20 000/005] [RESEND v2] dmfe: number of fixes and features Maxim
2007-02-15 20:55 ` [PATCH 2.6.20 001/005] [RESEND v2] dmfe : trivial/spelling fixes Maxim
2007-02-15 21:04 ` Maxim [this message]
2007-02-15 21:08 ` Subject: [PATCH 2.6.20 003/005] [RESEND v2] dmfe: Fix link detection Maxim
2007-02-15 21:11 ` Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume Maxim
2007-02-17 11:50 ` Pavel Machek
2007-02-17 22:29 ` Maxim
2007-02-17 22:52 ` Pavel Machek
2007-02-18 13:43 ` Maxim
2007-02-19 11:41 ` Pavel Machek
2007-02-15 21:16 ` [PATCH 2.6.20 005/005] [RESEND v2] dmfe: add support for Wake on lan Maxim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200702152304.03835.maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.