Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ice: double lock on adev_mutex
Date: Wed, 11 Jan 2023 12:01:11 +0100	[thread overview]
Message-ID: <20230111110111.20099-1-michal.swiatkowski@linux.intel.com> (raw)

Call trace:
ice_set_channel() --> mutex_lock(adev_mutex)
ice_vsi_recfg_qs()
ice_pf_dcb_recfg()
ice_send_event_to_aux() --> another mutex_lock(adev_mutex)

This call trace is reached when user try to change queues amount using
ethtool:
$ ethtool -L enp24s0f0np0 tx 64 rx 32

Avoid double lock by unlocking after checking if RDMA is active.

Fixes: a49a2713f00e ("ice: Prevent set_channel from changing queues while RDMA active")
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 263d59929602..54fc2ca823f5 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3729,22 +3729,21 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
 	mutex_lock(&pf->adev_mutex);
 	if (pf->adev && pf->adev->dev.driver) {
 		netdev_err(dev, "Cannot change channels when RDMA is active\n");
-		ret = -EINVAL;
-		goto adev_unlock;
+		mutex_unlock(&pf->adev_mutex);
+		return -EINVAL;
 	}
+	mutex_unlock(&pf->adev_mutex);
 
 	ice_vsi_recfg_qs(vsi, new_rx, new_tx);
 
 	if (!netif_is_rxfh_configured(dev)) {
 		ret = ice_vsi_set_dflt_rss_lut(vsi, new_rx);
-		goto adev_unlock;
+		return ret;
 	}
 
 	/* Update rss_size due to change in Rx queues */
 	vsi->rss_size = ice_get_valid_rss_size(&pf->hw, new_rx);
 
-adev_unlock:
-	mutex_unlock(&pf->adev_mutex);
 	return ret;
 }
 
-- 
2.36.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

             reply	other threads:[~2023-01-11 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 11:01 Michal Swiatkowski [this message]
2023-01-13  1:11 ` [Intel-wired-lan] [PATCH] ice: double lock on adev_mutex Jesse Brandeburg
2023-01-13 15:48   ` Michal Swiatkowski
2023-01-19  9:43 ` G, GurucharanX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230111110111.20099-1-michal.swiatkowski@linux.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox