From: Manuel Bessler Date: Fri, 16 Dec 2016 03:55:00 +0000 (-0500) Subject: r6040: move spinlock in r6040_close as SOFTIRQ-unsafe lock order detected X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c762eaa777b789540e3fe33581d6d0e593dbb22e;p=linux-beck.git r6040: move spinlock in r6040_close as SOFTIRQ-unsafe lock order detected 'ifconfig eth0 down' makes r6040_close() trigger: INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected Fixed by moving calls to phy_stop(), napi_disable(), netif_stop_queue() to outside of the module's private spin_lock_irq block. Found on a Versalogic Tomcat SBC with a Vortex86 SoC s1660e_5150:~# sudo ifconfig eth0 down [ 61.306415] ====================================================== [ 61.306415] [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ] [ 61.306415] 4.9.0-gb898d2d-manuel #1 Not tainted [ 61.306415] ------------------------------------------------------ [ 61.306415] ifconfig/449 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire: [ 61.306415] (&dev->lock){+.+...}, at: [] phy_stop+0x16/0x80 [ 61.306415] and this task is already holding: [ 61.306415] (&(&lp->lock)->rlock){+.-...}, at: [] r6040_close+0x24/0x230 [r6040] which would create a new lock dependency: [ 61.306415] (&(&lp->lock)->rlock){+.-...} -> (&dev->lock){+.+...} [ 61.306415] but this new dependency connects a SOFTIRQ-irq-safe lock: [ 61.306415] (&(&lp->lock)->rlock){+.-...} [ 61.306415] ... which became SOFTIRQ-irq-safe at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x555/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] _raw_spin_lock_irqsave+0x24/0x40 [ 61.306415] [ 61.306415] [] r6040_start_xmit+0x30/0x1d0 [r6040] [ 61.306415] [ 61.306415] [] dev_hard_start_xmit+0x9d/0x2d0 [ 61.306415] [ 61.306415] [] sch_direct_xmit+0xa8/0x140 [ 61.306415] [ 61.306415] [] __dev_queue_xmit+0x416/0x780 [ 61.306415] [ 61.306415] [] dev_queue_xmit+0xa/0x10 [ 61.306415] [ 61.306415] [] neigh_resolve_output+0x147/0x220 [ 61.306415] [ 61.306415] [] ip6_finish_output2+0x2fb/0x910 [ 61.306415] [ 61.306415] [] ip6_finish_output+0xa6/0x1a0 [ 61.306415] [ 61.306415] [] ip6_output+0x55/0x320 [ 61.306415] [ 61.306415] [] mld_sendpack+0x352/0x560 [ 61.306415] [ 61.306415] [] mld_ifc_timer_expire+0x155/0x280 [ 61.306415] [ 61.306415] [] call_timer_fn+0x81/0x270 [ 61.306415] [ 61.306415] [] expire_timers+0xc1/0x180 [ 61.306415] [ 61.306415] [] run_timer_softirq+0x77/0x150 [ 61.306415] [ 61.306415] [] __do_softirq+0xb4/0x3d0 [ 61.306415] [ 61.306415] [] do_softirq_own_stack+0x1c/0x30 [ 61.306415] [ 61.306415] [] irq_exit+0x8e/0xa0 [ 61.306415] [ 61.306415] [] do_IRQ+0x51/0x100 [ 61.306415] [ 61.306415] [] common_interrupt+0x36/0x40 [ 61.306415] [ 61.306415] [] set_root+0x68/0xf0 [ 61.306415] [ 61.306415] [] path_init+0x400/0x640 [ 61.306415] [ 61.306415] [] path_lookupat+0xf/0xe0 [ 61.306415] [ 61.306415] [] filename_lookup+0x6c/0x100 [ 61.306415] [ 61.306415] [] user_path_at_empty+0x25/0x30 [ 61.306415] [ 61.306415] [] SyS_faccessat+0x86/0x1e0 [ 61.306415] [ 61.306415] [] SyS_access+0x10/0x20 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] [ 61.306415] to a SOFTIRQ-irq-unsafe lock: [ 61.306415] (&dev->lock){+.+...} [ 61.306415] ... which became SOFTIRQ-irq-unsafe at: [ 61.306415] ...[ 61.306415] [ 61.306415] [] __lock_acquire+0x59c/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] [ 61.306415] [] phy_probe+0x4d/0xc0 [ 61.306415] [ 61.306415] [] phy_attach_direct+0xbe/0x190 [ 61.306415] [ 61.306415] [] phy_connect_direct+0x17/0x60 [ 61.306415] [ 61.306415] [] phy_connect+0x33/0x70 [ 61.306415] [ 61.306415] [] r6040_init_one+0x3a0/0x500 [r6040] [ 61.306415] [ 61.306415] [] pci_device_probe+0x77/0xd0 [ 61.306415] [ 61.306415] [] driver_probe_device+0x145/0x280 [ 61.306415] [ 61.306415] [] __driver_attach+0x89/0x90 [ 61.306415] [ 61.306415] [] bus_for_each_dev+0x4f/0x80 [ 61.306415] [ 61.306415] [] driver_attach+0x14/0x20 [ 61.306415] [ 61.306415] [] bus_add_driver+0x197/0x210 [ 61.306415] [ 61.306415] [] driver_register+0x51/0xd0 [ 61.306415] [ 61.306415] [] __pci_register_driver+0x45/0x50 [ 61.306415] [ 61.306415] [] 0xd0938017 [ 61.306415] [ 61.306415] [] do_one_initcall+0x2f/0x140 [ 61.306415] [ 61.306415] [] do_init_module+0x4a/0x19b [ 61.306415] [ 61.306415] [] load_module+0x1b2e/0x2070 [ 61.306415] [ 61.306415] [] SyS_finit_module+0x69/0x80 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] [ 61.306415] other info that might help us debug this: [ 61.306415] [ 61.306415] Possible interrupt unsafe locking scenario: [ 61.306415] [ 61.306415] CPU0 CPU1 [ 61.306415] ---- ---- [ 61.306415] lock(&dev->lock); [ 61.306415] local_irq_disable(); [ 61.306415] lock(&(&lp->lock)->rlock); [ 61.306415] lock(&dev->lock); [ 61.306415] [ 61.306415] lock(&(&lp->lock)->rlock); [ 61.306415] [ 61.306415] *** DEADLOCK *** [ 61.306415] [ 61.306415] 2 locks held by ifconfig/449: [ 61.306415] #0: (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0xf/0x20 [ 61.306415] #1: (&(&lp->lock)->rlock){+.-...}, at: [] r6040_close+0x24/0x230 [r6040] [ 61.306415] [ 61.306415] the dependencies between SOFTIRQ-irq-safe lock and the holding lock: [ 61.306415] -> (&(&lp->lock)->rlock){+.-...} ops: 3049 { [ 61.306415] HARDIRQ-ON-W at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x577/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] _raw_spin_lock+0x1b/0x30 [ 61.306415] [ 61.306415] [] r6040_poll+0x2c/0x330 [r6040] [ 61.306415] [ 61.306415] [] net_rx_action+0x197/0x340 [ 61.306415] [ 61.306415] [] __do_softirq+0xb4/0x3d0 [ 61.306415] [ 61.306415] [] run_ksoftirqd+0x17/0x40 [ 61.306415] [ 61.306415] [] smpboot_thread_fn+0x141/0x180 [ 61.306415] [ 61.306415] [] kthread+0xde/0x110 [ 61.306415] [ 61.306415] [] ret_from_fork+0x19/0x30 [ 61.306415] IN-SOFTIRQ-W at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x555/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] _raw_spin_lock_irqsave+0x24/0x40 [ 61.306415] [ 61.306415] [] r6040_start_xmit+0x30/0x1d0 [r6040] [ 61.306415] [ 61.306415] [] dev_hard_start_xmit+0x9d/0x2d0 [ 61.306415] [ 61.306415] [] sch_direct_xmit+0xa8/0x140 [ 61.306415] [ 61.306415] [] __dev_queue_xmit+0x416/0x780 [ 61.306415] [ 61.306415] [] dev_queue_xmit+0xa/0x10 [ 61.306415] [ 61.306415] [] neigh_resolve_output+0x147/0x220 [ 61.306415] [ 61.306415] [] ip6_finish_output2+0x2fb/0x910 [ 61.306415] [ 61.306415] [] ip6_finish_output+0xa6/0x1a0 [ 61.306415] [ 61.306415] [] ip6_output+0x55/0x320 [ 61.306415] [ 61.306415] [] mld_sendpack+0x352/0x560 [ 61.306415] [ 61.306415] [] mld_ifc_timer_expire+0x155/0x280 [ 61.306415] [ 61.306415] [] call_timer_fn+0x81/0x270 [ 61.306415] [ 61.306415] [] expire_timers+0xc1/0x180 [ 61.306415] [ 61.306415] [] run_timer_softirq+0x77/0x150 [ 61.306415] [ 61.306415] [] __do_softirq+0xb4/0x3d0 [ 61.306415] [ 61.306415] [] do_softirq_own_stack+0x1c/0x30 [ 61.306415] [ 61.306415] [] irq_exit+0x8e/0xa0 [ 61.306415] [ 61.306415] [] do_IRQ+0x51/0x100 [ 61.306415] [ 61.306415] [] common_interrupt+0x36/0x40 [ 61.306415] [ 61.306415] [] set_root+0x68/0xf0 [ 61.306415] [ 61.306415] [] path_init+0x400/0x640 [ 61.306415] [ 61.306415] [] path_lookupat+0xf/0xe0 [ 61.306415] [ 61.306415] [] filename_lookup+0x6c/0x100 [ 61.306415] [ 61.306415] [] user_path_at_empty+0x25/0x30 [ 61.306415] [ 61.306415] [] SyS_faccessat+0x86/0x1e0 [ 61.306415] [ 61.306415] [] SyS_access+0x10/0x20 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] INITIAL USE at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x1fe/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] _raw_spin_lock_irqsave+0x24/0x40 [ 61.306415] [ 61.306415] [] r6040_get_stats+0x1e/0x60 [r6040] [ 61.306415] [ 61.306415] [] dev_get_stats+0x96/0xc0 [ 61.306415] [ 61.306415] [] rtnl_fill_stats+0x36/0xfd [ 61.306415] [ 61.306415] [] rtnl_fill_ifinfo+0x47c/0xce0 [ 61.306415] [ 61.306415] [] rtmsg_ifinfo_build_skb+0x4e/0xd0 [ 61.306415] [ 61.306415] [] rtmsg_ifinfo.part.20+0x10/0x40 [ 61.306415] [ 61.306415] [] rtmsg_ifinfo+0x1b/0x20 [ 61.306415] [ 61.306415] [] register_netdevice+0x409/0x550 [ 61.306415] [ 61.306415] [] register_netdev+0x12/0x20 [ 61.306415] [ 61.306415] [] r6040_init_one+0x3e8/0x500 [r6040] [ 61.306415] [ 61.306415] [] pci_device_probe+0x77/0xd0 [ 61.306415] [ 61.306415] [] driver_probe_device+0x145/0x280 [ 61.306415] [ 61.306415] [] __driver_attach+0x89/0x90 [ 61.306415] [ 61.306415] [] bus_for_each_dev+0x4f/0x80 [ 61.306415] [ 61.306415] [] driver_attach+0x14/0x20 [ 61.306415] [ 61.306415] [] bus_add_driver+0x197/0x210 [ 61.306415] [ 61.306415] [] driver_register+0x51/0xd0 [ 61.306415] [ 61.306415] [] __pci_register_driver+0x45/0x50 [ 61.306415] [ 61.306415] [] 0xd0938017 [ 61.306415] [ 61.306415] [] do_one_initcall+0x2f/0x140 [ 61.306415] [ 61.306415] [] do_init_module+0x4a/0x19b [ 61.306415] [ 61.306415] [] load_module+0x1b2e/0x2070 [ 61.306415] [ 61.306415] [] SyS_finit_module+0x69/0x80 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] } [ 61.306415] ... key at: [] __key.45893+0x0/0xfffff739 [r6040] [ 61.306415] ... acquired at: [ 61.306415] [ 61.306415] [] check_irq_usage+0x42/0xb0 [ 61.306415] [ 61.306415] [] __lock_acquire+0x110c/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] [ 61.306415] [] phy_stop+0x16/0x80 [ 61.306415] [ 61.306415] [] r6040_close+0x89/0x230 [r6040] [ 61.306415] [ 61.306415] [] __dev_close_many+0x61/0xa0 [ 61.306415] [ 61.306415] [] __dev_close+0x1f/0x30 [ 61.306415] [ 61.306415] [] __dev_change_flags+0x87/0x150 [ 61.306415] [ 61.306415] [] dev_change_flags+0x23/0x60 [ 61.306415] [ 61.306415] [] devinet_ioctl+0x5f8/0x6f0 [ 61.306415] [ 61.306415] [] inet_ioctl+0x65/0x90 [ 61.306415] [ 61.306415] [] sock_ioctl+0x124/0x2b0 [ 61.306415] [ 61.306415] [] do_vfs_ioctl+0x7c/0x790 [ 61.306415] [ 61.306415] [] SyS_ioctl+0x28/0x50 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] [ 61.306415] the dependencies between the lock to be acquired[ 61.306415] and SOFTIRQ-irq-unsafe lock: [ 61.306415] -> (&dev->lock){+.+...} ops: 56 { [ 61.306415] HARDIRQ-ON-W at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x577/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] [ 61.306415] [] phy_probe+0x4d/0xc0 [ 61.306415] [ 61.306415] [] phy_attach_direct+0xbe/0x190 [ 61.306415] [ 61.306415] [] phy_connect_direct+0x17/0x60 [ 61.306415] [ 61.306415] [] phy_connect+0x33/0x70 [ 61.306415] [ 61.306415] [] r6040_init_one+0x3a0/0x500 [r6040] [ 61.306415] [ 61.306415] [] pci_device_probe+0x77/0xd0 [ 61.306415] [ 61.306415] [] driver_probe_device+0x145/0x280 [ 61.306415] [ 61.306415] [] __driver_attach+0x89/0x90 [ 61.306415] [ 61.306415] [] bus_for_each_dev+0x4f/0x80 [ 61.306415] [ 61.306415] [] driver_attach+0x14/0x20 [ 61.306415] [ 61.306415] [] bus_add_driver+0x197/0x210 [ 61.306415] [ 61.306415] [] driver_register+0x51/0xd0 [ 61.306415] [ 61.306415] [] __pci_register_driver+0x45/0x50 [ 61.306415] [ 61.306415] [] 0xd0938017 [ 61.306415] [ 61.306415] [] do_one_initcall+0x2f/0x140 [ 61.306415] [ 61.306415] [] do_init_module+0x4a/0x19b [ 61.306415] [ 61.306415] [] load_module+0x1b2e/0x2070 [ 61.306415] [ 61.306415] [] SyS_finit_module+0x69/0x80 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] SOFTIRQ-ON-W at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x59c/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] [ 61.306415] [] phy_probe+0x4d/0xc0 [ 61.306415] [ 61.306415] [] phy_attach_direct+0xbe/0x190 [ 61.306415] [ 61.306415] [] phy_connect_direct+0x17/0x60 [ 61.306415] [ 61.306415] [] phy_connect+0x33/0x70 [ 61.306415] [ 61.306415] [] r6040_init_one+0x3a0/0x500 [r6040] [ 61.306415] [ 61.306415] [] pci_device_probe+0x77/0xd0 [ 61.306415] [ 61.306415] [] driver_probe_device+0x145/0x280 [ 61.306415] [ 61.306415] [] __driver_attach+0x89/0x90 [ 61.306415] [ 61.306415] [] bus_for_each_dev+0x4f/0x80 [ 61.306415] [ 61.306415] [] driver_attach+0x14/0x20 [ 61.306415] [ 61.306415] [] bus_add_driver+0x197/0x210 [ 61.306415] [ 61.306415] [] driver_register+0x51/0xd0 [ 61.306415] [ 61.306415] [] __pci_register_driver+0x45/0x50 [ 61.306415] [ 61.306415] [] 0xd0938017 [ 61.306415] [ 61.306415] [] do_one_initcall+0x2f/0x140 [ 61.306415] [ 61.306415] [] do_init_module+0x4a/0x19b [ 61.306415] [ 61.306415] [] load_module+0x1b2e/0x2070 [ 61.306415] [ 61.306415] [] SyS_finit_module+0x69/0x80 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] INITIAL USE at: [ 61.306415] [ 61.306415] [] __lock_acquire+0x1fe/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] [ 61.306415] [] phy_probe+0x4d/0xc0 [ 61.306415] [ 61.306415] [] phy_attach_direct+0xbe/0x190 [ 61.306415] [ 61.306415] [] phy_connect_direct+0x17/0x60 [ 61.306415] [ 61.306415] [] phy_connect+0x33/0x70 [ 61.306415] [ 61.306415] [] r6040_init_one+0x3a0/0x500 [r6040] [ 61.306415] [ 61.306415] [] pci_device_probe+0x77/0xd0 [ 61.306415] [ 61.306415] [] driver_probe_device+0x145/0x280 [ 61.306415] [ 61.306415] [] __driver_attach+0x89/0x90 [ 61.306415] [ 61.306415] [] bus_for_each_dev+0x4f/0x80 [ 61.306415] [ 61.306415] [] driver_attach+0x14/0x20 [ 61.306415] [ 61.306415] [] bus_add_driver+0x197/0x210 [ 61.306415] [ 61.306415] [] driver_register+0x51/0xd0 [ 61.306415] [ 61.306415] [] __pci_register_driver+0x45/0x50 [ 61.306415] [ 61.306415] [] 0xd0938017 [ 61.306415] [ 61.306415] [] do_one_initcall+0x2f/0x140 [ 61.306415] [ 61.306415] [] do_init_module+0x4a/0x19b [ 61.306415] [ 61.306415] [] load_module+0x1b2e/0x2070 [ 61.306415] [ 61.306415] [] SyS_finit_module+0x69/0x80 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] } [ 61.306415] ... key at: [] __key.43998+0x0/0x8 [ 61.306415] ... acquired at: [ 61.306415] [ 61.306415] [] check_irq_usage+0x42/0xb0 [ 61.306415] [ 61.306415] [] __lock_acquire+0x110c/0x1770 [ 61.306415] [ 61.306415] [] lock_acquire+0x7c/0x150 [ 61.306415] [ 61.306415] [] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] [ 61.306415] [] phy_stop+0x16/0x80 [ 61.306415] [ 61.306415] [] r6040_close+0x89/0x230 [r6040] [ 61.306415] [ 61.306415] [] __dev_close_many+0x61/0xa0 [ 61.306415] [ 61.306415] [] __dev_close+0x1f/0x30 [ 61.306415] [ 61.306415] [] __dev_change_flags+0x87/0x150 [ 61.306415] [ 61.306415] [] dev_change_flags+0x23/0x60 [ 61.306415] [ 61.306415] [] devinet_ioctl+0x5f8/0x6f0 [ 61.306415] [ 61.306415] [] inet_ioctl+0x65/0x90 [ 61.306415] [ 61.306415] [] sock_ioctl+0x124/0x2b0 [ 61.306415] [ 61.306415] [] do_vfs_ioctl+0x7c/0x790 [ 61.306415] [ 61.306415] [] SyS_ioctl+0x28/0x50 [ 61.306415] [ 61.306415] [] do_int80_syscall_32+0x3f/0x110 [ 61.306415] [ 61.306415] [] restore_all+0x0/0x61 [ 61.306415] [ 61.306415] [ 61.306415] stack backtrace: [ 61.306415] CPU: 0 PID: 449 Comm: ifconfig Not tainted 4.9.0-gb898d2d-manuel #1 [ 61.306415] Call Trace: [ 61.306415] dump_stack+0x16/0x19 [ 61.306415] check_usage+0x3f6/0x550 [ 61.306415] ? check_usage+0x4d/0x550 [ 61.306415] check_irq_usage+0x42/0xb0 [ 61.306415] __lock_acquire+0x110c/0x1770 [ 61.306415] lock_acquire+0x7c/0x150 [ 61.306415] ? phy_stop+0x16/0x80 [ 61.306415] mutex_lock_nested+0x2d/0x4a0 [ 61.306415] ? phy_stop+0x16/0x80 [ 61.306415] ? r6040_close+0x24/0x230 [r6040] [ 61.306415] ? __delay+0x9/0x10 [ 61.306415] phy_stop+0x16/0x80 [ 61.306415] r6040_close+0x89/0x230 [r6040] [ 61.306415] __dev_close_many+0x61/0xa0 [ 61.306415] __dev_close+0x1f/0x30 [ 61.306415] __dev_change_flags+0x87/0x150 [ 61.306415] dev_change_flags+0x23/0x60 [ 61.306415] devinet_ioctl+0x5f8/0x6f0 [ 61.306415] inet_ioctl+0x65/0x90 [ 61.306415] sock_ioctl+0x124/0x2b0 [ 61.306415] ? dlci_ioctl_set+0x30/0x30 [ 61.306415] do_vfs_ioctl+0x7c/0x790 [ 61.306415] ? trace_hardirqs_on+0xb/0x10 [ 61.306415] ? call_rcu_sched+0xd/0x10 [ 61.306415] ? __put_cred+0x32/0x50 [ 61.306415] ? SyS_faccessat+0x178/0x1e0 [ 61.306415] SyS_ioctl+0x28/0x50 [ 61.306415] do_int80_syscall_32+0x3f/0x110 [ 61.306415] entry_INT80_32+0x2f/0x2f [ 61.306415] EIP: 0xb764d364 [ 61.306415] EFLAGS: 00000286 CPU: 0 [ 61.306415] EAX: ffffffda EBX: 00000004 ECX: 00008914 EDX: bfa99d7c [ 61.306415] ESI: bfa99e4c EDI: fffffffe EBP: 00000004 ESP: bfa99d58 [ 61.306415] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b [ 63.836607] r6040 0000:00:08.0 eth0: Link is Down Signed-off-by: Manuel Bessler Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c index 4ff4e0491406..aa11b70b9ca4 100644 --- a/drivers/net/ethernet/rdc/r6040.c +++ b/drivers/net/ethernet/rdc/r6040.c @@ -472,8 +472,6 @@ static void r6040_down(struct net_device *dev) iowrite16(adrp[0], ioaddr + MID_0L); iowrite16(adrp[1], ioaddr + MID_0M); iowrite16(adrp[2], ioaddr + MID_0H); - - phy_stop(dev->phydev); } static int r6040_close(struct net_device *dev) @@ -481,12 +479,12 @@ static int r6040_close(struct net_device *dev) struct r6040_private *lp = netdev_priv(dev); struct pci_dev *pdev = lp->pdev; - spin_lock_irq(&lp->lock); + phy_stop(dev->phydev); napi_disable(&lp->napi); netif_stop_queue(dev); - r6040_down(dev); - free_irq(dev->irq, dev); + spin_lock_irq(&lp->lock); + r6040_down(dev); /* Free RX buffer */ r6040_free_rxbufs(dev); @@ -496,6 +494,8 @@ static int r6040_close(struct net_device *dev) spin_unlock_irq(&lp->lock); + free_irq(dev->irq, dev); + /* Free Descriptor memory */ if (lp->rx_ring) { pci_free_consistent(pdev,