From patchwork Tue Nov 26 11:04:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 11261933 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 C3DC114DB for ; Tue, 26 Nov 2019 11:04:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A228B20722 for ; Tue, 26 Nov 2019 11:04:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="A3Wt5usZ"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="FJKKxsim"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="GIzl29EQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A228B20722 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0jkNJPBA0GYzOS+5gzsldPEmmK6G0kFZSiVjPumWOi4=; b=A3Wt5usZGXt4WcYiWLJ19ctrqo uFCNTDDSnN5CSUmC7Ezclip4k7o2l5xUHGGyqVsYoepHxt1NDiH1qihKTR4wJBZ6CMtR7pjpLN7EW WdEBxgxLsVNBOoX3YE3za6akBymULyViBdI2J9e/rL9nNnfHicBW7f3ZxT99HyENIi5MAudxekQDr gvx132A5RsVd6+cTQBjacesG2A1sTs8jGFfygXa1m4RMPqqkNsfAtgxlHgFoSUSDGMSKdTnhtVPoi 3sUqkFY/YRi6PFxn/Ca1lic428g4RexIQsBgBAptm3N4YZuFHAWZJ5b9Ah2ikaAIy2hptIOuKLGe5 3HBRx26Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZYeL-0003aH-Ki; Tue, 26 Nov 2019 11:04:53 +0000 Received: from a27-186.smtp-out.us-west-2.amazonses.com ([54.240.27.186]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZYeI-0002jj-2k for ath11k@lists.infradead.org; Tue, 26 Nov 2019 11:04:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574766289; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=N0KFSViNp6dbv8JN49RBq/u51L+g0F6cC8pD7HsH63o=; b=FJKKxsimx1LuyohLCdSPQbvYffwlvpFa59ymggm7D6BYbuFypWsdG9VO45x7ijtR a888o1ThLGUjBbY0QD1Er9AQfwfuEn5Vukat6vwR9BBzGQUqvrxAW1mBnDrpeKoRkFk mi4NYLmcU7AXqwLpWWhIzJrKns4fHRIzlsWmv1Ak= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574766289; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=N0KFSViNp6dbv8JN49RBq/u51L+g0F6cC8pD7HsH63o=; b=GIzl29EQ7PEJqgbVXjj5hlRkThl+a0TRjkus2+9LVV3zJgTMUIhDwcUw6r4QPYFI djN/A7hwqLnCQBsvtyvR36xeK/iyvmSEUvAUr+EUaCdSxbLfcN039LuzuscaluYxrBv K3Y+dn+MJVCMpu7gm2BnqyyUiKXsxyRbtDaVOY6Q= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CD4E3C447A1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 03/10] ath11k: fix wmi service ready ext tlv parsing Date: Tue, 26 Nov 2019 11:04:49 +0000 Message-ID: <0101016ea762a1ec-0099c5b1-2401-4627-8e9d-0e781ab6be45-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574766279-13105-1-git-send-email-kvalo@codeaurora.org> References: <1574766279-13105-1-git-send-email-kvalo@codeaurora.org> X-SES-Outgoing: 2019.11.26-54.240.27.186 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191126_030450_185788_2A3F272D X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [54.240.27.186 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ath11k@lists.infradead.org MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org From: Anilkumar Kolli The current ath11k driver failed to parse wmi_tlv_svc_rdy_ext_parse if there is change in wmi_mac_phy_capabilities length with below error. ath11k c000000.wifi1: failed to extract mac caps, idx :0 ath11k c000000.wifi1: failed to parse tlv -22 This is needed to get firmware version WLAN.HK.2.0.0.1-00240-QCAHKSWPL_SILICONZ-1 working. Signed-off-by: Anilkumar Kolli Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/wmi.c | 14 +++++++++++--- drivers/net/wireless/ath/ath11k/wmi.h | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 2c3c973f5f7c..ccebf7ce420a 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -310,7 +310,7 @@ ath11k_pull_mac_phy_cap_svc_ready_ext(struct ath11k_pdev_wmi *wmi_handle, if (phy_id >= hal_reg_caps->num_phy) return -EINVAL; - mac_phy_caps = &wmi_mac_phy_caps[phy_idx]; + mac_phy_caps = wmi_mac_phy_caps + phy_idx; pdev->pdev_id = mac_phy_caps->pdev_id; pdev_cap->supported_bands = mac_phy_caps->supported_bands; @@ -2959,6 +2959,15 @@ static int ath11k_wmi_tlv_mac_phy_caps_parse(struct ath11k_base *soc, if (svc_rdy_ext->n_mac_phy_caps >= svc_rdy_ext->tot_phy_id) return -ENOBUFS; + len = min_t(u16, len, sizeof(struct wmi_mac_phy_capabilities)); + if (!svc_rdy_ext->n_mac_phy_caps) { + svc_rdy_ext->mac_phy_caps = kzalloc((svc_rdy_ext->tot_phy_id) * len, + GFP_ATOMIC); + if (!svc_rdy_ext->mac_phy_caps) + return -ENOMEM; + } + + memcpy(svc_rdy_ext->mac_phy_caps + svc_rdy_ext->n_mac_phy_caps, ptr, len); svc_rdy_ext->n_mac_phy_caps++; return 0; } @@ -3092,8 +3101,6 @@ static int ath11k_wmi_tlv_svc_rdy_ext_parse(struct ath11k_base *ab, svc_rdy_ext->hw_mode_done = true; } else if (!svc_rdy_ext->mac_phy_done) { svc_rdy_ext->n_mac_phy_caps = 0; - svc_rdy_ext->mac_phy_caps = - (struct wmi_mac_phy_capabilities *)ptr; ret = ath11k_wmi_tlv_iter(ab, ptr, len, ath11k_wmi_tlv_mac_phy_caps_parse, svc_rdy_ext); @@ -3134,6 +3141,7 @@ static int ath11k_service_ready_ext_event(struct ath11k_base *ab, return ret; } + kfree(svc_rdy_ext.mac_phy_caps); return 0; } diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 7d5690c65279..6a0468094694 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -2276,7 +2276,6 @@ struct wmi_hw_mode_capabilities { #define WMI_MAX_HECAP_PHY_SIZE (3) struct wmi_mac_phy_capabilities { - u32 tlv_header; u32 hw_mode_id; u32 pdev_id; u32 phy_id;