LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] NET: r8169: fix oops in r8169_get_mac_version
@ 2008-04-17 15:02 Ivan Vecera
  0 siblings, 0 replies; only message in thread
From: Ivan Vecera @ 2008-04-17 15:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: romieu

When does r8169_get_mac_version find unknown MAC then kernel crash occurs
because tp->pci_dev is NULL and is dereferenced. Problem is that the function
r8169_get_mac_version is called from rtl8169_init_one at line 1704 but
tp->pci_dev is filled at line 1780.

Ivan

---
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 3acfeea..a45c8e8 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1700,6 +1700,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		msleep_interruptible(1);
 	}
 
+	/* rtl8169_get_mac_version uses tp->pci_dev when unknown MAC found */
+	tp->pci_dev = pdev;
+
 	/* Identify chip attached to board */
 	rtl8169_get_mac_version(tp, ioaddr);
 
@@ -1777,7 +1780,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 #endif
 
 	tp->intr_mask = 0xffff;
-	tp->pci_dev = pdev;
 	tp->mmio_addr = ioaddr;
 	tp->align = cfg->align;
 	tp->hw_start = cfg->hw_start;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-17 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17 15:02 [PATCH] NET: r8169: fix oops in r8169_get_mac_version Ivan Vecera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).