From patchwork Wed Nov 13 05:15:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapathi Bhat X-Patchwork-Id: 11241103 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 25A961709 for ; Wed, 13 Nov 2019 05:15:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 052E022459 for ; Wed, 13 Nov 2019 05:15:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="KWKc4Da4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726160AbfKMFPo (ORCPT ); Wed, 13 Nov 2019 00:15:44 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:63934 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726087AbfKMFPo (ORCPT ); Wed, 13 Nov 2019 00:15:44 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAD59u1r021829; Tue, 12 Nov 2019 21:15:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=WeNRinFdTnxt91l8lIGbvTKtH0Y8WtPSSkvIGRBUSFQ=; b=KWKc4Da4peRpAwHuDK4ejzpjDABk3AoYXYFPeLwh17AOMhvgxUrCV8fWwHCWEPwvXrif y1bcvksU43fxwdaxXMxZhAvzwVJdV5+32vu86g4u3ZTJ/qwHVBNOIFMgL54kukf3Aszb KYv8Mau8H0Ia/W2vFZVuxpro+NPmPipUWTjbMru3KIRMDjMHKtos04XTS2GoLersbZgQ pMbL1LVnV3hn8G3wiHrxCDyUAgnqSAl3rrHXrbPxoG+bK1UZu1NjY+/UNCYdZcdwyXP5 2hbksH+7hFqLCPz6mjQCU0PEsLmw4sRVDS8xXUhwB7nLVAn/yFT1CQaVWJy1gWvAmqaZ Fw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2w5wurxcmf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 12 Nov 2019 21:15:42 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Nov 2019 21:15:40 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 12 Nov 2019 21:15:40 -0800 Received: from testmailhost.marvell.com (unknown [10.31.130.105]) by maili.marvell.com (Postfix) with ESMTP id 7BF683F7044; Tue, 12 Nov 2019 21:15:37 -0800 (PST) From: Ganapathi Bhat To: CC: Cathy Luo , Zhiyuan Yang , James Cao , Rakesh Parmar , Brian Norris , Sharvari Harisangam , Ganapathi Bhat Subject: [PATCH 1/2] mwifiex: fix requesting zero memory for firmware dump Date: Wed, 13 Nov 2019 10:45:31 +0530 Message-ID: <1573622132-16181-1-git-send-email-gbhat@marvell.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-12_10:2019-11-11,2019-11-12 signatures=0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sharvari Harisangam mwifiex_pcie_fw_dump would read firmware scratch registers, to get the size of the dump. It does a vmalloc of memory_size + 1, read above, to save the dump. It is possible that the value read by memory_size scratch register be invalid, i.e 0xffffffff. This would pass an invalid size(0) to vmalloc. To fix this check for invalid scratch register read. Signed-off-by: Sharvari Harisangam Signed-off-by: Ganapathi Bhat --- drivers/net/wireless/marvell/mwifiex/pcie.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index fc1706d..483b521 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -2727,6 +2727,13 @@ static void mwifiex_pcie_fw_dump(struct mwifiex_adapter *adapter) break; } + if (memory_size == 0xffffffff) { + mwifiex_dbg(adapter, ERROR, + "Invalid dump size: 0x%x, for %s\n", + memory_size, entry->mem_name); + return; + } + mwifiex_dbg(adapter, DUMP, "%s_SIZE=0x%x\n", entry->mem_name, memory_size); entry->mem_ptr = vmalloc(memory_size + 1); From patchwork Wed Nov 13 05:15:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapathi Bhat X-Patchwork-Id: 11241105 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 1FD0A1747 for ; Wed, 13 Nov 2019 05:15:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 000DC222D0 for ; Wed, 13 Nov 2019 05:15:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="TjAsk2HJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726179AbfKMFPs (ORCPT ); Wed, 13 Nov 2019 00:15:48 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:52540 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726087AbfKMFPr (ORCPT ); Wed, 13 Nov 2019 00:15:47 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAD5A64X022265; Tue, 12 Nov 2019 21:15:46 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=fYQTauQNC0MAoFWL7Zs+9Y3ugiCBdGCUNsP72L/xVrI=; b=TjAsk2HJuS5jBzcBcfpwmfr4efF5QCogd7EeRRQTaHsHlRWmxQBe3REvv7zVP1qnvm3I mo/RQt3Hof0nl6V1KGNsiPilL2XfhZAWBHYU3bqC7fH/ysFrRfGYxsho2lJ5941v+Ees O/jbpKO57tkYJoLGIHZwzzRYxiIC8K/spbg3Bnz4LQDc2rNjcqWe0xyo3GVTHsaoM6i5 JI8ny8tFW4wfJurqj9sw6q3ygziYZGWmJ+lhT5DRXMZgSqAlB9t/caphhxST22/7tqwR NupFvti7HlomKzvW2TeuvaLzAaHRD6Q9BRorPiUXCiYa6WMENBf9nv4evS2FiEf3Bqep tg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2w5wurxcmw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 12 Nov 2019 21:15:46 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Nov 2019 21:15:44 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 12 Nov 2019 21:15:44 -0800 Received: from testmailhost.marvell.com (unknown [10.31.130.105]) by maili.marvell.com (Postfix) with ESMTP id 50FC53F703F; Tue, 12 Nov 2019 21:15:42 -0800 (PST) From: Ganapathi Bhat To: CC: Cathy Luo , Zhiyuan Yang , James Cao , Rakesh Parmar , Brian Norris , Sharvari Harisangam , Ganapathi Bhat Subject: [PATCH 2/2] mwifiex: do not download TX packets if interface has not resumed Date: Wed, 13 Nov 2019 10:45:32 +0530 Message-ID: <1573622132-16181-2-git-send-email-gbhat@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1573622132-16181-1-git-send-email-gbhat@marvell.com> References: <1573622132-16181-1-git-send-email-gbhat@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-12_10:2019-11-11,2019-11-12 signatures=0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sharvari Harisangam mwifiex_queue_tx_pkt would queue the TX packet to driver queues and before return, would invoke main_work, which in turn would download the packet to firmware. In case the card is in sleep state, driver would wakeup the card(via interface). During resume it is possible that, the applications send packets even before interface has completed its resume. If driver try to access interface register(to wakeup the card), it would lead to invalid results. To avoid this, don't invoke main_work, when hs_activated is set. Signed-off-by: Sharvari Harisangam Signed-off-by: Ganapathi Bhat --- drivers/net/wireless/marvell/mwifiex/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index a9657ae..7b5cf2c0 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -808,6 +808,11 @@ int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb) mwifiex_wmm_add_buf_txqueue(priv, skb); } + if (priv->adapter->hs_activated) { + mwifiex_dbg(priv->adapter, ERROR, "hs_activated: queue TX\n"); + return 0; + } + mwifiex_queue_main_work(priv->adapter); return 0;