Commit b29bc220 authored by Preethi Banala's avatar Preethi Banala Committed by Jeff Kirsher

ice: Clean control queues only when they are initialized

Clean control queues only when they are initialized. One of the ways to
validate if the basic initialization is done is by checking value of
cq->sq.head and cq->rq.head variables that specify the register address.
This patch adds a check to avoid NULL pointer dereference crash when tried
to shutdown uninitialized control queue.
Signed-off-by: default avatarPreethi Banala <preethi.banala@intel.com>
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent f8ba7db8
...@@ -597,10 +597,14 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw) ...@@ -597,10 +597,14 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw)
return 0; return 0;
init_ctrlq_free_rq: init_ctrlq_free_rq:
if (cq->rq.head) {
ice_shutdown_rq(hw, cq); ice_shutdown_rq(hw, cq);
mutex_destroy(&cq->rq_lock);
}
if (cq->sq.head) {
ice_shutdown_sq(hw, cq); ice_shutdown_sq(hw, cq);
mutex_destroy(&cq->sq_lock); mutex_destroy(&cq->sq_lock);
mutex_destroy(&cq->rq_lock); }
return status; return status;
} }
...@@ -706,10 +710,14 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type) ...@@ -706,10 +710,14 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
return; return;
} }
if (cq->sq.head) {
ice_shutdown_sq(hw, cq); ice_shutdown_sq(hw, cq);
ice_shutdown_rq(hw, cq);
mutex_destroy(&cq->sq_lock); mutex_destroy(&cq->sq_lock);
}
if (cq->rq.head) {
ice_shutdown_rq(hw, cq);
mutex_destroy(&cq->rq_lock); mutex_destroy(&cq->rq_lock);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment