All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [net PATCH v1] i40e: fix recursive rtnl lock
@ 2015-09-24 19:20 Jesse Brandeburg
  2015-09-25 22:45 ` Jesse Brandeburg
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Brandeburg @ 2015-09-24 19:20 UTC (permalink / raw)
  To: intel-wired-lan

From: Anjali Singhai Jain <anjali.singhai@intel.com>

The sync_vsi_filters function can be called directly under RTNL
or through the timer subtask without one.  This was causing
a deadlock.

If sync_vsi_filter is called from a thread which held the lock,
and in another thread the PROMISC setting got changed we would be
executing the PROMISC change in the thread which already held the
lock alongside the other filter update. The PROMISC change
requires a reset if we are on a VEB, which requires it to be
called under RTNL.

Earlier the driver would call reset for PROMISC change without
checking if we were already under RTNL and would try to grab
it causing a deadlock. This patch changes the flow to see if we
are already under RTNL before trying to grab it.

Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Kiran Patil <kiran.patil@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 3410fb3..7557c02 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5340,9 +5340,13 @@ exit:
  **/
 void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags)
 {
-	rtnl_lock();
-	i40e_do_reset(pf, reset_flags);
-	rtnl_unlock();
+	if (!rtnl_is_locked()) {
+		rtnl_lock();
+		i40e_do_reset(pf, reset_flags);
+		rtnl_unlock();
+	} else {
+		i40e_do_reset(pf, reset_flags);
+	}
 }
 
 /**
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-28 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 19:20 [Intel-wired-lan] [net PATCH v1] i40e: fix recursive rtnl lock Jesse Brandeburg
2015-09-25 22:45 ` Jesse Brandeburg
2015-09-28 23:20   ` Jesse Brandeburg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.