]> git.baikalelectronics.ru Git - kernel.git/commit
tg3: Fix soft lockup when tg3_reset_task() fails.
authorMichael Chan <michael.chan@broadcom.com>
Thu, 3 Sep 2020 18:28:54 +0000 (14:28 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Sep 2020 19:16:54 +0000 (12:16 -0700)
commit78fc5836d72e3ca06f1688d6188b45199e9f04c7
tree1049f810bd303c532ddd4cfb196787f3d382e69d
parentdaeb2b3034d03a3e3fb8f3ecb282ca426c66e7f4
tg3: Fix soft lockup when tg3_reset_task() fails.

If tg3_reset_task() fails, the device state is left in an inconsistent
state with IFF_RUNNING still set but NAPI state not enabled.  A
subsequent operation, such as ifdown or AER error can cause it to
soft lock up when it tries to disable NAPI state.

Fix it by bringing down the device to !IFF_RUNNING state when
tg3_reset_task() fails.  tg3_reset_task() running from workqueue
will now call tg3_close() when the reset fails.  We need to
modify tg3_reset_task_cancel() slightly to avoid tg3_close()
calling cancel_work_sync() to cancel tg3_reset_task().  Otherwise
cancel_work_sync() will wait forever for tg3_reset_task() to
finish.

Reported-by: David Christensen <drc@linux.vnet.ibm.com>
Reported-by: Baptiste Covolato <baptiste@arista.com>
Fixes: 108f9177dafc ("tg3: Schedule at most one tg3_reset_task run")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c