Skip to content

Commit

Permalink
r8169: NULL pointer dereference on r8169 load
Browse files Browse the repository at this point in the history
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 <petr@vandrovec.name>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Petr Vandrovec authored and David S. Miller committed Oct 13, 2008
1 parent f3073ac commit 738e1e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 738e1e6

Please sign in to comment.