From patchwork Wed Jun 20 08:42:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 10476643 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.web.codeaurora.org (Postfix) with ESMTP id 8ED68604D3 for ; Wed, 20 Jun 2018 09:04:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 817A628758 for ; Wed, 20 Jun 2018 09:04:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7648B28BDF; Wed, 20 Jun 2018 09:04:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 5D8B528758 for ; Wed, 20 Jun 2018 09:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754666AbeFTJD3 (ORCPT ); Wed, 20 Jun 2018 05:03:29 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:42634 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753933AbeFTIme (ORCPT ); Wed, 20 Jun 2018 04:42:34 -0400 Received: by mail-lf0-f65.google.com with SMTP id z207-v6so3671382lff.9 for ; Wed, 20 Jun 2018 01:42:33 -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; bh=sYHap52ZFvU1YoFIXSmQWxFDIVLNqxp0/nUZxn+RUiA=; b=U9JM/8RwFdaS17LbpXbCXWptnGIcJfe/tM6C3jZ8qTPndyZ8spk0st/f+uDaJZJSUK 4mZTRvU1j0Dad0HcGPnujz9k7ehPn3X6h0mpwaLQTIlmiCg17xIMdai+vLRVfwdahnmQ QYq6etRoMjhxGn9BWsFx8Mhw9VsSHe5YlTqnk= 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; bh=sYHap52ZFvU1YoFIXSmQWxFDIVLNqxp0/nUZxn+RUiA=; b=d9k9z/XirSSMVrqodemrzpRJklH3ib/TNjTo51BZc4AJcLdvOLRzHuQ8w3KNsDhUVC 5hB0fIiWCZOc+RWmaczySr02b/SCBdfTSAvprOnU6yp9zOhhiG8f7w9YfU/hBTqxEygr ukXJMHMw2rJGF8h49ZEJMn+aIe3bE9XJf8MUbwN4L7O3ooG+K9W8h7Ffomz9M5Ial2ay rTtGePky2QuUR6cnw5/3KwkXrQsfRMZTDwDBn62pmXQKFi0OtTIXo6YkZ1sjnKp6+Xar f8MMBNMAO0Dyj/W/MRQ2DyfKy78QgXH1ssQR6Jw/SD/diuNnPSbowF0J0Wii9AW2j07D jGJQ== X-Gm-Message-State: APt69E18lP97onU1N7MfUjlHEh8cIJrPH4ucEOYBm/JxNZcfeucQhywq mLzSnI4G5TLTUD2SNFSJDza1aw== X-Google-Smtp-Source: ADUXVKJWpHxRqCeghmtVb9Fae9OZh1TCsprzeURFGjtiKnumr9YTr4okShMqAtm7ARrgrTsHcP+s3g== X-Received: by 2002:a2e:3011:: with SMTP id w17-v6mr14437016ljw.20.1529484153062; Wed, 20 Jun 2018 01:42:33 -0700 (PDT) Received: from centauri.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id l25-v6sm301267ljj.30.2018.06.20.01.42.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 01:42:32 -0700 (PDT) From: Niklas Cassel To: Kalle Valo , "David S. Miller" Cc: alagusankar@silex-india.com, Niklas Cassel , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ath10k: sdio: allocate correct size for RECV_1MORE_BLOCK rx packets Date: Wed, 20 Jun 2018 10:42:21 +0200 Message-Id: <20180620084222.3521-3-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620084222.3521-1-niklas.cassel@linaro.org> References: <20180620084222.3521-1-niklas.cassel@linaro.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Without this, when receiving a packet that has this flag set from firmware, we will read invalid trailer data from the packet, which will be shown as various errors, e.g. "sdio mbox lookahead is zero" or "invalid rx packet" or "payload length x exceeds max htc length". Signed-off-by: Alagu Sankar Signed-off-by: Niklas Cassel --- drivers/net/wireless/ath/ath10k/htc.h | 1 + drivers/net/wireless/ath/ath10k/sdio.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h index 34877597dd6a..cf1068dc3254 100644 --- a/drivers/net/wireless/ath/ath10k/htc.h +++ b/drivers/net/wireless/ath/ath10k/htc.h @@ -58,6 +58,7 @@ enum ath10k_htc_tx_flags { }; enum ath10k_htc_rx_flags { + ATH10K_HTC_FLAGS_RECV_1MORE_BLOCK = 0x01, ATH10K_HTC_FLAG_TRAILER_PRESENT = 0x02, ATH10K_HTC_FLAG_BUNDLE_MASK = 0xF0 }; diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index d46523b0472c..0c57d6aaa437 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -603,6 +603,9 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, * ATH10K_HTC_FLAG_BUNDLE_MASK flag set, all bundled * packet skb's have been allocated in the previous step. */ + if (htc_hdr->flags & ATH10K_HTC_FLAGS_RECV_1MORE_BLOCK) + full_len += ATH10K_HIF_MBOX_BLOCK_SIZE; + ret = ath10k_sdio_mbox_alloc_rx_pkt(&ar_sdio->rx_pkts[i], act_len, full_len,