2008-10-12 08:40:49

by Petr Vandrovec

[permalink] [raw]
Subject: [PATCH] Fix NULL pointer dereference on r8169 load

From: Petr Vandrovec <[email protected]>

mmio_addr in r8169 needs to be initialized before use

Maybe that all tp-> initialization should be moved before rtl_init_mac_address call,
but this is enough to get rid of crash in rtl_rar_set due to mmio_addr being uninitialized.

Signed-off-by: Petr Vandrovec <[email protected]>

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index bdae2c5..c821da2 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2154,6 +2154,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)

spin_lock_init(&tp->lock);

+ tp->mmio_addr = ioaddr;
+
rtl_init_mac_address(tp, ioaddr);

/* Get MAC address */
@@ -2186,7 +2188,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif

tp->intr_mask = 0xffff;
- tp->mmio_addr = ioaddr;
tp->align = cfg->align;
tp->hw_start = cfg->hw_start;
tp->intr_event = cfg->intr_event;


2008-10-13 03:59:28

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] Fix NULL pointer dereference on r8169 load

From: Petr Vandrovec <[email protected]>
Date: Sun, 12 Oct 2008 10:13:52 +0200

> From: Petr Vandrovec <[email protected]>
>
> mmio_addr in r8169 needs to be initialized before use
>
> Maybe that all tp-> initialization should be moved before rtl_init_mac_address call,
> but this is enough to get rid of crash in rtl_rar_set due to mmio_addr being uninitialized.
>
> Signed-off-by: Petr Vandrovec <[email protected]>

Applied, thanks Petr.