From patchwork Fri Oct 11 18:28:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11186173 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A03614DB for ; Fri, 11 Oct 2019 18:28:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AB6D218AC for ; Fri, 11 Oct 2019 18:28:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DmSSa+o/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728862AbfJKS22 (ORCPT ); Fri, 11 Oct 2019 14:28:28 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42509 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728735AbfJKS2W (ORCPT ); Fri, 11 Oct 2019 14:28:22 -0400 Received: by mail-pg1-f195.google.com with SMTP id f14so1140520pgi.9 for ; Fri, 11 Oct 2019 11:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8oCcxD88VFm1cXltnKInhOC0dvYbRf3OZje5KuISZ28=; b=DmSSa+o/fbCnmcSE8r3LLdGEcw4nF+cZDPt6n9Uav/Mh/6eUQUBdpUuOVjFil99enF yW+l+bqqnjB2LexYRbSpMwtzwWFE8E9D/KnGVyNJulBfAtHABiiSDzWBGbr2X/OK+XT8 L9Hviw5kazL60EJ6JyhVmA3PsPTO5Un7UcOuq97b7+LwEoOnaInyOvbl78GA8DDCEIu4 pKdxSQq3K3wzCSHxveT1nB+mV+iSi/AR5oKe8Z4vigMNNzWYy96byVbfG3DpQQRkesij 1jl1r0OfXGl8OxMN96Wtp706aglMlW6IEQw6UURw+hIsGYJAX+wP3AqwzZkaV0dSvvrt Iz+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8oCcxD88VFm1cXltnKInhOC0dvYbRf3OZje5KuISZ28=; b=OI6NjId19P0xscBQet1TEb2abVS8v4HVMRu+JSVnvUbWv3wjSwHM3QQz+LBQy6dCIE 8r0Q5lMvazlnaJ5NJSNvKFLnLEFz3KrjfC7IGG6j6QVb0HtG2aj2VLo+Ahk1yCuCtap7 fIn+oP05QqVzDmP8mT7eZC1l1pyBfGhUOhpEEX7yGcI+coTOgY5l4flUpJJ5DPOZd2Q4 fvfAq3SyqDyOY6YhhRCpbGJI8xjBQaNFfRTOfJxlGVSQA/9OWg3qzeM660BclM5pN9Yr o/CyCwQZI9KiohD8JZz8hpRxTaBNdsknYUS9xYVpr6FTJK1Xjzj/iqL+2GVaES3WdoWo Lieg== X-Gm-Message-State: APjAAAXoGuJavJpWgcH4IjidNJUOvpLf4dKbbbqezqDWefRFjit1BV4S F2K5Uu6EZ1VYKyi7tnl8R35Tiw== X-Google-Smtp-Source: APXvYqw0pkpNYcFqFnQAxe70uYZ67hQnflJjxtKuMR2lnBw5aheockxkUpH2gAVY12yHDaYAukkmnw== X-Received: by 2002:a17:90b:288:: with SMTP id az8mr19023217pjb.18.1570818501530; Fri, 11 Oct 2019 11:28:21 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id a11sm8652343pfo.165.2019.10.11.11.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2019 11:28:20 -0700 (PDT) From: Bjorn Andersson To: Kalle Valo , "David S. Miller" Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Niklas Cassel Subject: [PATCH v2] ath10k: Correct error handling of dma_map_single() Date: Fri, 11 Oct 2019 11:28:17 -0700 Message-Id: <20191011182817.194565-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010162653.141303-1-bjorn.andersson@linaro.org> References: MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The return value of dma_map_single() should be checked for errors using dma_mapping_error() and the skb has been dequeued so it needs to be freed. Fixes: 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi") Reported-by: Niklas Cassel Signed-off-by: Bjorn Andersson --- Changes since v1: - Free the dequeued skb drivers/net/wireless/ath/ath10k/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 3d2c8fcba952..e8bdb2ba9b18 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3904,8 +3904,10 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) ar->running_fw->fw_file.fw_features)) { paddr = dma_map_single(ar->dev, skb->data, skb->len, DMA_TO_DEVICE); - if (!paddr) + if (dma_mapping_error(ar->dev, paddr)) { + ieee80211_free_txskb(ar->hw, skb); continue; + } ret = ath10k_wmi_mgmt_tx_send(ar, skb, paddr); if (ret) { ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n",