From patchwork Tue Apr 9 19:08:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10891959 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 D2BB717E6 for ; Tue, 9 Apr 2019 19:13:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBC3A2880D for ; Tue, 9 Apr 2019 19:13:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B03CC28938; Tue, 9 Apr 2019 19:13:34 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,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 D6DCB2880D for ; Tue, 9 Apr 2019 19:13:32 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=PQIu6dGnYLZp93njX4Pgox+E0OY6gTYfQkAvH419VOk=; b=VfIkU0qvzuZJtJ HvkBj/9vT18m+7tQ+rFyRq+44EWiRNfoRHuIrN3qsnv8OEc2gxYgDU5SzzgAmyM9SDel6U1reG4J0 f8Xh3xVjZRTB9C1IRhIvLewy/a9W4qRcqhpM1wng6ptqbtolWD2F157FkhTHrB8A23q05+c7fiEJR R/b1QJnjYLupxKAGO2K/KlJCp6GZuprhJl4Eq2QYVcEb9jDqRDIXbxFwTAcroTJ0BPewieUztDBIn EtlEmjt5CyR5uLR3awwcavNWllbL7yYQsvOWojf/uphLK/7fqADXPk9+0RXt9d83dkvdUlmJhSbXB JdDbM9kas8hEYomxybXA==; 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 1hDwBW-0002B7-0f; Tue, 09 Apr 2019 19:13:30 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwBG-0001nE-Hj for ath10k@lists.infradead.org; Tue, 09 Apr 2019 19:13:19 +0000 Received: by mail-lj1-x244.google.com with SMTP id h21so3768066ljk.13 for ; Tue, 09 Apr 2019 12:13:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=/ZgmwsOUvL4cKbF6D9YKv0p4xEXY9j80R7avVYQ6UI0=; b=H3bCQx3exrZ0HBPbVbu6n0uCFMuB4H1sYutNKjDZRNIHpagZwfeNWuKhhpWwto2BzQ hjbj2h0o71K148CKobrgRqK9mGNcgBQi9NcnABFC9z97q38X4J0PuSjWoJ0ZREKIi53L kAhue8PlIXsDE3XL8Fy9MbBHTKbpBrq+32PkS+nrhlhhBIzcZ8bB+SoYMVltRLkjosC/ +hgYwxjycmayVB/TERuDbZ02RNPZrrSzF+2sJ26PDE6pWRsCr+BixIhniG2Sh7rBWxpa UV6fA1ntEtJPRhHuCptxnV7BVZC2SYysrjzR/L94FHDmjy5ixFnrRKYfk+prCCvwGsrw I4xA== 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:mime-version:content-transfer-encoding; bh=/ZgmwsOUvL4cKbF6D9YKv0p4xEXY9j80R7avVYQ6UI0=; b=YZ6w0m+4qdj3ABjVV7eKpxLUZrv3UeiUAMVI+35TjWd/pECZkf4+9Ff7pavk2QVbBd kqjJfB9H5GGSG7kqLy/MHG51GW6KXJsJ9j/Xsq0LTRfJbfntd6fpWhC972aukdyqX3hl AVOERu29feI8hEaUdk3p3R9ska6qBLcPBKGTucU5gUpxEeC+taKtiBs+4pRO+pIEe+Iu mENFUNGGVkTjihrP+oOXxiw3p8aE6uyHYVSJ+fskKGJhVFQHhs0JmMZ58pfV9rNeQzV6 oT0x+e/Byxtc5uqXJZfQa5++AFgt/84k3kpajyw+K4i/wLskj7q9cL9vq4CYZzXpXOB0 iWnw== X-Gm-Message-State: APjAAAUEOETJ1aQAwq43NridpCIkByBRy/IUh3XLZgQmx2ohg4uyq/3F GeLZ9FC8RonOw1KJBLX3fic= X-Google-Smtp-Source: APXvYqx9staw3h/hQ7QTrkRRwaxoH0Z/0nyV6Zy3AFumUaN7lcxZe9XrFEsKhHGoSWGnlNA8HgkOCA== X-Received: by 2002:a2e:998d:: with SMTP id w13mr20579638lji.110.1554837192973; Tue, 09 Apr 2019 12:13:12 -0700 (PDT) Received: from localhost.localdomain (81-233-89-221-no75.tbcn.telia.com. [81.233.89.221]) by smtp.gmail.com with ESMTPSA id q64sm6807848ljq.76.2019.04.09.12.13.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:13:12 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [PATCH 6/6] ath10k: sdio: replace skb_trim with explicit set of skb->len Date: Tue, 9 Apr 2019 21:08:51 +0200 Message-Id: <20190409190851.4557-7-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190409190851.4557-1-erik.stromdahl@gmail.com> References: <20190409190851.4557-1-erik.stromdahl@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_121314_752539_87DFF153 X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Stromdahl Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes a bug with padding of the skb data buffer. Since skb_trim can only be used to reduce the skb len, it is useless when we pad (increase the length of) the skb. Instead we must set skb->len directly. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/sdio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 3eb241cb8a25..989e3f563f3d 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -1496,7 +1496,12 @@ static int ath10k_sdio_hif_tx_sg(struct ath10k *ar, u8 pipe_id, skb = items[i].transfer_context; padded_len = ath10k_sdio_calc_txrx_padded_len(ar_sdio, skb->len); - skb_trim(skb, padded_len); + /* FIXME: unsure if just extending the skb len is the right + * thing to do since we might read outside the skb->data + * buffer. But we really don't want to realloc the skb just to + * pad the length. + */ + skb->len = padded_len; /* Write TX data to the end of the mbox address space */ address = ar_sdio->mbox_addr[eid] + ar_sdio->mbox_size[eid] -