From patchwork Fri May 10 10:19:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10938543 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 615C8933 for ; Fri, 10 May 2019 10:19:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45DE528B89 for ; Fri, 10 May 2019 10:19:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A23D28C33; Fri, 10 May 2019 10:19:43 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34AD928B89 for ; Fri, 10 May 2019 10:19:42 +0000 (UTC) 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:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NgQSoJKruxCAvmEjLP4+qOdD69gMsC9FxiswQ3f2slE=; b=Du5S6MmCYOHXHJ iZj+3BCviamf4ROgd4lJhkQeoW2NSL94zetzOHJ0e2gxfh+qxHKTWhJo4akpCWNbNoiHDhEIvnUFU YfiI3G7qbDMKPmhTwPLApoeb3/NfKcILXUHJa7y+sr/WFCZxzJ+YuVtwtLjaeiVR51eo2JI434sDK sfoCDGGpYXd0yo7Nf23DRD7McdrOaL+lJI1Vq05bFoXcXAA0InoVuY+v996IEvbPt8n+SuiiW3tmC PXqliC9YMXKaTovPRoPwBJ0UCXvIaP6i52A0fCK+fllSTEcn++WuEuoq3DFdzvjtAcxH2UKnjEBZj hVLJjRMEomlSdx1mRtlQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP2cu-0000Qc-Mn; Fri, 10 May 2019 10:19:40 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP2cr-0000Q2-Uj for ath11k@lists.infradead.org; Fri, 10 May 2019 10:19:39 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D50B56087D; Fri, 10 May 2019 10:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557483570; bh=50fqfZwuRXKilhivsRb+0u8KwZw530FPOvbL+b1dFYU=; h=From:To:Cc:Subject:Date:From; b=oFIXBCMJWNEEGiK6crPMjw4I68IFG1FBjDpYskbVYZP+ewJxbDkDpIrM3QT8B45IX l+1U+R0WC3M8Fbk2QRukoLbmgSDLmy52fldiAT2ibIHrRIlymKlfGEpbeXyFN5lplE ZV6WBEexKI5hvSIEIvA/9ulR1iIgUC7K8KmuTLSQ= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: akolli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C01AC60AA8; Fri, 10 May 2019 10:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557483569; bh=50fqfZwuRXKilhivsRb+0u8KwZw530FPOvbL+b1dFYU=; h=From:To:Cc:Subject:Date:From; b=TM2lCdh5spBldyy2wW6tW1ZOn3F9bVp6wYO0aLFeAWhURRv+LQjjbDVp9J5N4gBhV HzRdX+uu/TfK7b6gvTDT25v3Zy+hOT+XTB44pZ9R7yv6Lavzmv62j5R4/fu/ZCj3Ss mN1zJIQUYhsIBDtacwGzdcOfMWoKvyLQALBw3Z9I= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C01AC60AA8 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=akolli@codeaurora.org From: Anilkumar Kolli To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: Add sanity check in htt pktlog Date: Fri, 10 May 2019 15:49:19 +0530 Message-Id: <1557483559-15843-1-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_031938_009807_4D6CB7FD X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add sanity check before processing pktlog buffer. Signed-off-by: Anilkumar Kolli --- drivers/net/wireless/ath/ath11k/debug.h | 2 ++ drivers/net/wireless/ath/ath11k/dp_rx.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h index e51235f62536..13973d972169 100644 --- a/drivers/net/wireless/ath/ath11k/debug.h +++ b/drivers/net/wireless/ath/ath11k/debug.h @@ -68,6 +68,8 @@ struct debug_htt_stats_req { #define ATH11K_FW_STATS_BUF_SIZE (1024 * 1024) +#define ATH11K_HTT_PKTLOG_MAX_SIZE 2048 + enum ath11k_pktlog_filter { ATH11K_PKTLOG_RX = 0x000000001, ATH11K_PKTLOG_TX = 0x000000002, diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 0796f3ba8333..c7582ce08899 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1072,6 +1072,15 @@ static void ath11k_htt_pktlog(struct ath11k_base *ab, u8 pdev_id; len = FIELD_GET(HTT_T2H_PPDU_STATS_PAYLOAD_SIZE_M, *data); + + if (len > ATH11K_HTT_PKTLOG_MAX_SIZE) + { + ath11k_warn(ab, "htt pktlog buffer size %d, expected < %d\n", + len, + ATH11K_HTT_PKTLOG_MAX_SIZE); + return; + } + pdev_id = FIELD_GET(HTT_T2H_PPDU_STATS_PDEV_ID_M, *data); pdev_id = DP_HW2SW_MACID(pdev_id); ar = ab->pdevs[pdev_id].ar;