aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_controlq.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2018-09-19 20:23:04 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-09-27 11:00:21 -0400
commitdec64ff10ed9a2b7ba33be924e3b8329d169fb3f (patch)
tree475cff85e1daf3c5bb98a8a7d9bd2e3971cd9ffe /drivers/net/ethernet/intel/ice/ice_controlq.c
parent1042caa79e9351b81ed19dc8d2d7fd6ff51a4422 (diff)
ice: use [sr]q.count when checking if queue is initialized
When shutting down the controlqs, we check if they are initialized before we shut them down and destroy the lock. This is important, as it prevents attempts to access the lock of an already shutdown queue. Unfortunately, we checked rq.head and sq.head as the value to determine if the queue was initialized. This doesn't work, because head is not reset when the queue is shutdown. In some flows, the adminq will have already been shut down prior to calling ice_shutdown_all_ctrlqs. This can result in a crash due to attempting to access the already destroyed mutex. Fix this by using rq.count and sq.count instead. Indeed, ice_shutdown_sq and ice_shutdown_rq already indicate that this is the value we should be using to determine of the queue was initialized. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_controlq.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_controlq.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c
index 1fe026a65d75..3c736b90a6bf 100644
--- a/drivers/net/ethernet/intel/ice/ice_controlq.c
+++ b/drivers/net/ethernet/intel/ice/ice_controlq.c
@@ -597,11 +597,11 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw)
597 return 0; 597 return 0;
598 598
599init_ctrlq_free_rq: 599init_ctrlq_free_rq:
600 if (cq->rq.head) { 600 if (cq->rq.count) {
601 ice_shutdown_rq(hw, cq); 601 ice_shutdown_rq(hw, cq);
602 mutex_destroy(&cq->rq_lock); 602 mutex_destroy(&cq->rq_lock);
603 } 603 }
604 if (cq->sq.head) { 604 if (cq->sq.count) {
605 ice_shutdown_sq(hw, cq); 605 ice_shutdown_sq(hw, cq);
606 mutex_destroy(&cq->sq_lock); 606 mutex_destroy(&cq->sq_lock);
607 } 607 }
@@ -710,11 +710,11 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
710 return; 710 return;
711 } 711 }
712 712
713 if (cq->sq.head) { 713 if (cq->sq.count) {
714 ice_shutdown_sq(hw, cq); 714 ice_shutdown_sq(hw, cq);
715 mutex_destroy(&cq->sq_lock); 715 mutex_destroy(&cq->sq_lock);
716 } 716 }
717 if (cq->rq.head) { 717 if (cq->rq.count) {
718 ice_shutdown_rq(hw, cq); 718 ice_shutdown_rq(hw, cq);
719 mutex_destroy(&cq->rq_lock); 719 mutex_destroy(&cq->rq_lock);
720 } 720 }