aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShahar S Matityahu <shahar.s.matityahu@intel.com>2017-04-06 06:35:38 -0400
committerLuca Coelho <luciano.coelho@intel.com>2017-06-05 14:47:10 -0400
commitdc1cd1d5ac22dbcd158c3de62b76ebb80e55d46b (patch)
treeb66a7c78e2c5ea2019902619285d706a4f16e4d7
parent15098803d38778070b8edfa5a3d5fc4fef10d0a1 (diff)
iwlwifi: fix host command memory leaks
Sending host command with CMD_WANT_SKB flag demands the release of the response buffer with iwl_free_resp function. The patch adds the memory release in all the relevant places Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
index 9fb46a6f47cf..9c9bfbbabdf1 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
@@ -906,7 +906,7 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
906 906
907 if (WARN_ON(iwl_rx_packet_payload_len(hcmd.resp_pkt) != sizeof(*rsp))) { 907 if (WARN_ON(iwl_rx_packet_payload_len(hcmd.resp_pkt) != sizeof(*rsp))) {
908 ret = -EINVAL; 908 ret = -EINVAL;
909 goto error; 909 goto error_free_resp;
910 } 910 }
911 911
912 rsp = (void *)hcmd.resp_pkt->data; 912 rsp = (void *)hcmd.resp_pkt->data;
@@ -915,13 +915,13 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
915 if (qid > ARRAY_SIZE(trans_pcie->txq)) { 915 if (qid > ARRAY_SIZE(trans_pcie->txq)) {
916 WARN_ONCE(1, "queue index %d unsupported", qid); 916 WARN_ONCE(1, "queue index %d unsupported", qid);
917 ret = -EIO; 917 ret = -EIO;
918 goto error; 918 goto error_free_resp;
919 } 919 }
920 920
921 if (test_and_set_bit(qid, trans_pcie->queue_used)) { 921 if (test_and_set_bit(qid, trans_pcie->queue_used)) {
922 WARN_ONCE(1, "queue %d already used", qid); 922 WARN_ONCE(1, "queue %d already used", qid);
923 ret = -EIO; 923 ret = -EIO;
924 goto error; 924 goto error_free_resp;
925 } 925 }
926 926
927 txq->id = qid; 927 txq->id = qid;
@@ -934,8 +934,11 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
934 (txq->write_ptr) | (qid << 16)); 934 (txq->write_ptr) | (qid << 16));
935 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d\n", qid); 935 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d\n", qid);
936 936
937 iwl_free_resp(&hcmd);
937 return qid; 938 return qid;
938 939
940error_free_resp:
941 iwl_free_resp(&hcmd);
939error: 942error:
940 iwl_pcie_gen2_txq_free_memory(trans, txq); 943 iwl_pcie_gen2_txq_free_memory(trans, txq);
941 return ret; 944 return ret;