r8169: fix panic when using unlisted MAC
Subsystems (2)
PATCH 1/1 r8169: fix panic when using unlisted MAC
When using the r8169 driver with an unlisted MAC, the system will panic in rtl8169_get_mac_version since it will try to access tp->pci_dev when it's unset. Moving the call to set pci_dev earlier in rtnl8169_init_one will resolve this and should not introduce any other problems.
--- drivers/net/r8169.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/r8169.c +1 -1
@@ -1617,6 +1617,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)SET_NETDEV_DEV (dev, &pdev->dev); tp =netdev_priv (dev); tp->dev = dev; + tp->pci_dev = pdev; tp->msg_enable =netif_msg_init (debug.msg_enable,R8169_MSG_DEFAULT );/* enable device (incl. PCI PM wakeup and hotplug setup) */
@@ -1777,7 +1778,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;
Signature · 1 line
1.5.2.1
Andy Gospodarek <[email protected]> :
[...]
Quoted 5 lines
When using the r8169 driver with an unlisted MAC, the system will panic in
rtl8169_get_mac_versionsince it will try to accesstp->pci_devwhen it's unset. Moving the call to setpci_devearlier inrtnl8169_init_onewill resolve this and should not introduce any other problems.
This change has already been committed in Linus's tree.
Signature · 1 line
Ueimor
Quoted 10 lines · Francois Romieu
Andy Gospodarek <[email protected]> :
[...]Quoted 5 lines
When using the r8169 driver with an unlisted MAC, the system will panic in
rtl8169_get_mac_versionsince it will try to accesstp->pci_devwhen it's unset. Moving the call to setpci_devearlier inrtnl8169_init_onewill resolve this and should not introduce any other problems.This change has already been committed in Linus's tree.
Hmmm, apparently I need to communicate better with Ivan.... :-)