Commit baec9957 authored by Michal Kazior's avatar Michal Kazior Committed by Kamal Mostafa

ath10k: fix dma_mapping_error() handling

commit 5e55e3cb upstream.

The function returns 1 when DMA mapping fails. The
driver would return bogus values and could
possibly confuse itself if DMA failed.

Fixes: 767d34fc ("ath10k: remove DMA mapping wrappers")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 9360d685
...@@ -163,8 +163,10 @@ int ath10k_htc_send(struct ath10k_htc *htc, ...@@ -163,8 +163,10 @@ int ath10k_htc_send(struct ath10k_htc *htc,
skb_cb->eid = eid; skb_cb->eid = eid;
skb_cb->paddr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE); skb_cb->paddr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
ret = dma_mapping_error(dev, skb_cb->paddr); ret = dma_mapping_error(dev, skb_cb->paddr);
if (ret) if (ret) {
ret = -EIO;
goto err_credits; goto err_credits;
}
sg_item.transfer_id = ep->eid; sg_item.transfer_id = ep->eid;
sg_item.transfer_context = skb; sg_item.transfer_context = skb;
......
...@@ -401,8 +401,10 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) ...@@ -401,8 +401,10 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len, skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
res = dma_mapping_error(dev, skb_cb->paddr); res = dma_mapping_error(dev, skb_cb->paddr);
if (res) if (res) {
res = -EIO;
goto err_free_txdesc; goto err_free_txdesc;
}
skb_put(txdesc, len); skb_put(txdesc, len);
cmd = (struct htt_cmd *)txdesc->data; cmd = (struct htt_cmd *)txdesc->data;
...@@ -487,8 +489,10 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) ...@@ -487,8 +489,10 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len, skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
res = dma_mapping_error(dev, skb_cb->paddr); res = dma_mapping_error(dev, skb_cb->paddr);
if (res) if (res) {
res = -EIO;
goto err_free_txbuf; goto err_free_txbuf;
}
if (likely(use_frags)) { if (likely(use_frags)) {
frags = skb_cb->htt.txbuf->frags; frags = skb_cb->htt.txbuf->frags;
......
...@@ -1363,8 +1363,10 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar, ...@@ -1363,8 +1363,10 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar,
req_paddr = dma_map_single(ar->dev, treq, req_len, DMA_TO_DEVICE); req_paddr = dma_map_single(ar->dev, treq, req_len, DMA_TO_DEVICE);
ret = dma_mapping_error(ar->dev, req_paddr); ret = dma_mapping_error(ar->dev, req_paddr);
if (ret) if (ret) {
ret = -EIO;
goto err_dma; goto err_dma;
}
if (resp && resp_len) { if (resp && resp_len) {
tresp = kzalloc(*resp_len, GFP_KERNEL); tresp = kzalloc(*resp_len, GFP_KERNEL);
...@@ -1376,8 +1378,10 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar, ...@@ -1376,8 +1378,10 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar,
resp_paddr = dma_map_single(ar->dev, tresp, *resp_len, resp_paddr = dma_map_single(ar->dev, tresp, *resp_len,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
ret = dma_mapping_error(ar->dev, resp_paddr); ret = dma_mapping_error(ar->dev, resp_paddr);
if (ret) if (ret) {
ret = EIO;
goto err_req; goto err_req;
}
xfer.wait_for_resp = true; xfer.wait_for_resp = true;
xfer.resp_len = 0; xfer.resp_len = 0;
......
...@@ -1920,6 +1920,7 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) ...@@ -1920,6 +1920,7 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
ath10k_warn(ar, "failed to map beacon: %d\n", ath10k_warn(ar, "failed to map beacon: %d\n",
ret); ret);
dev_kfree_skb_any(bcn); dev_kfree_skb_any(bcn);
ret = -EIO;
goto skip; goto skip;
} }
......
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