From patchwork Mon Jul 3 13:38:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 9823511 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6241060246 for ; Mon, 3 Jul 2017 15:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53D1D2621D for ; Mon, 3 Jul 2017 15:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 486AB2843C; Mon, 3 Jul 2017 15:02:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED2B92621D for ; Mon, 3 Jul 2017 15:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754732AbdGCPCi (ORCPT ); Mon, 3 Jul 2017 11:02:38 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:34425 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755367AbdGCNjB (ORCPT ); Mon, 3 Jul 2017 09:39:01 -0400 Received: by mail-qt0-f195.google.com with SMTP id m54so20925946qtb.1; Mon, 03 Jul 2017 06:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=KH5Ye/eZYodp+KLyVKNwbgQw1sohUJv27rSOlzfjdbU=; b=YK3Lj17+9yZ3EuK34WMerjMAXCD5YThuryL/+571NUaiakR54C8ZtDcsuaD7oZMzuS y2h5Nxvt4WoiNmMSIp9WTnuSrpuCe6txfAnwrAt7HW4+72Thv/l89e29IhITI/TzMhR/ mM93cuG0kXBv/IKWcpdtcF2P4dx8GxAedvjEDpfkdDQRZF8cDUevMW1QzQ5ySVoP1tVq vEdvSjA1aCWhzCL1PiEi4MdJWmJizJb/GIm17Atzg8lPjs8mDmLjbuyVruKa8+KG3OzI f0ukZdZ3tMKcrAy808In3rUaNX0+gkOklOFpM0QjI77lvceev7+SAI6v28ZjSlw6rSR2 8z6Q== 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; bh=KH5Ye/eZYodp+KLyVKNwbgQw1sohUJv27rSOlzfjdbU=; b=LgavuSq+f7NGOQauqVtCBkJYv/97wFRxTDPNopn4rnLYpIv8CB/MaIfetQxvSqNgGP T+6nR7C1SxG+EKbDtylL9GZ0wBsLqxxyIoj35W+EQ8T9mS0CX0RSeZr9b8VT6Mfo5QFS edEHGkIh0zOmRtLexdcYLMFZRGN/vcsnDIaZtLgSoyBQJ3aKmnriU6CDfKx76GnYKp5H ubdPLv5AiRQVi7641ASr9u2zIhZIAkVW18bmZP+DqXhbb0En3qbtFMHObNy3d044D6Ty ZfGWeauPPIOlj3kw2YSpdA/QMuhHSu0NJQvuVyKtK7Xw+dHsXoDXk4Xt7mki+iG4sg1K EpVg== X-Gm-Message-State: AKS2vOzukFeZI9oVVcIk2LAzo1qofsjlY323fMzenUHMJitP8aIWUwoH I8g3pbe891Hvd8KN4ZM= X-Received: by 10.200.8.187 with SMTP id v56mr45271649qth.213.1499089133888; Mon, 03 Jul 2017 06:38:53 -0700 (PDT) Received: from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a]) by smtp.gmail.com with ESMTPSA id m2sm12136656qtb.17.2017.07.03.06.38.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2017 06:38:52 -0700 (PDT) From: Rob Clark To: linux-arm-msm@vger.kernel.org Cc: Bjorn Andersson , Kalle Valo , linux-wireless@vger.kernel.org, Rob Clark Subject: [PATCH] wcn36xx: check dma_mapping_error() Date: Mon, 3 Jul 2017 09:38:45 -0400 Message-Id: <20170703133845.13638-1-robdclark@gmail.com> X-Mailer: git-send-email 2.9.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes splat: wcn36xx a204000.wcnss:smd-edge:wcnss:wifi: DMA-API: device driver failed to check map error[device address=0x00000000b45ba000] [size=3872 bytes] [mapped as single] ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at ../lib/dma-debug.c:1167 check_unmap+0x474/0x8d0 Modules linked in: bnep(E) arc4(E) wcn36xx(E) mac80211(E) btqcomsmd(E) btqca(E) bluetooth(E) cfg80211(E) ecdh_generic(E) rfkill(E) vfat(E) fat(E) wcnss_ctrl qcom_wcnss_pil(E) mdt_loader(E) qcom_common(E) remoteproc(E) crc32_ce(E) virtio_ring(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) virtio(E) snd_soc_lpass_platform(E) leds_gpio(E) snd_soc_hdmi_codec(E) snd_soc_apq8016_sbc(E) snd_soc_msm8916_digital(E) snd_soc_core(E) qcom_spmi_temp_alarm(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) snd_seq_device(E) snd_pcm(E) spi_qup(E) nvmem_qfprom(E) snd_timer(E) snd(E) soundcore(E) msm_rng(E) qcom_tsens(E) nvmem_core(E) uas(E) usb_storage(E) dm9601(E) cdc_ether(E) usbnet(E) mii(E) mmc_block(E) sdhci_msm(E) sdhci_pltfm(E) qcom_spmi_vadc(E) qcom_vadc_common(PE) clk_smd_rpm(E) industrialio(E) qcom_smd_regulator(E) pinctrl_spmi_mpp(E) pinctrl_spmi_gpio(E) rtc_pm8xxx(E) adv7511(E) smd_rpm(E) qcom_spmi_pmic(E) regmap_spmi(E) phy_msm_usb(E) usb3503(E) extcon_usb_gpio(E) ci_hdrc_msm(E) ci_hdrc(E) qcom_hwspinlock(E) udc_core(E) extcon_core(E) ehci_msm(E) i2c_qup(E) sdhci(E) msm(E) mmc_core(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) spmi_pmic_arb(E) drm(E) spmi(E) qcom_smd(E) rpmsg_core smsm(E) gpio_keys(E) smp2p(E) smem(E) hwspinlock_core(E) sunrpc(E) scsi_transport_iscsi(E) CPU: 0 PID: 0 Comm: swapper/0 Tainted: P E 4.12.0-rc7+ #1476 Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 2017.07-rc1-00234-g22fa70a-dirty 06/26/2017 task: ffff000009049780 task.stack: ffff000009030000 PC is at check_unmap+0x474/0x8d0 LR is at check_unmap+0x474/0x8d0 ... Mapped at: dma_entry_alloc+0x68/0xa8 debug_dma_map_page+0x94/0x148 wcn36xx_dxe_fill_skb.isra.1+0xbc/0xf8 [wcn36xx] wcn36xx_dxe_init+0x244/0x398 [wcn36xx] wcn36xx_start+0xf4/0x298 [wcn36xx] Signed-off-by: Rob Clark --- drivers/net/wireless/ath/wcn36xx/dxe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c index 87dfdaf..d5c810a 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -289,6 +289,11 @@ static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl *ctl) skb_tail_pointer(skb), WCN36XX_PKT_SIZE, DMA_FROM_DEVICE); + if (dma_mapping_error(dev, dxe->dst_addr_l)) { + dev_err(dev, "unable to map skb\n"); + kfree_skb(skb); + return -ENOMEM; + } ctl->skb = skb; return 0;