bnxt_en: Fix RTNL lock usage on bnxt_update_link().
authorMichael Chan <michael.chan@broadcom.com>
Wed, 25 Jan 2017 07:55:08 +0000 (02:55 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Jan 2017 18:27:13 +0000 (13:27 -0500)
commit0eaa24b971ae251ae9d3be23f77662a655532063
tree7824449b8cefcaa7f64df07d0cbcd60c24bfe1e6
parenta551ee94ea723b4af9b827c7460f108bc13425ee
bnxt_en: Fix RTNL lock usage on bnxt_update_link().

bnxt_update_link() is called from multiple code paths.  Most callers,
such as open, ethtool, already hold RTNL.  Only the caller bnxt_sp_task()
does not.  So it is a bug to take RTNL inside bnxt_update_link().

Fix it by removing the RTNL inside bnxt_update_link().  The function
now expects the caller to always hold RTNL.

In bnxt_sp_task(), call bnxt_rtnl_lock_sp() before calling
bnxt_update_link().  We also need to move the call to the end of
bnxt_sp_task() since it will be clearing the BNXT_STATE_IN_SP_TASK bit.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c