From patchwork Mon Jul 12 06:10:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472848 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2647260jao; Sun, 11 Jul 2021 23:28:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/+KUGDqeRaSsdv42XI2l4wGVbDcDlUseJMLyyWjkQUIlekqcXWFNNPyu+nPu/YYTsHVoX X-Received: by 2002:a17:906:cec1:: with SMTP id si1mr32560989ejb.18.1626071339149; Sun, 11 Jul 2021 23:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071339; cv=none; d=google.com; s=arc-20160816; b=m3Fu9XlS9MESy83NLFweMTsL45HXQfnszL7ynIZi97umopY5ZTTF//VOyZ7ir9M++T ozh8zIgNUFj6rJZWmwe+oV73vzqftq1VDUdVY4vuZpVd8LsCxjYX3VylmjtjaiHU9Mk1 vdmWlBRBve6ThI8hoJhcRRvpWO0Z6ka32MTpNoJCqskWVCiY094+Jpqw/7ytPBydQTET A2BZLzQFyJ2a00aiyNQDFGXNWj6stib4op/w4uBhNU1hMs9aAQKsnabl2qyoYJaByDNU zPGRqTMqj1fAThhSWXYJyownWdnrMRGnWNRBIymZDXRrJBkJaUEa+WCZhOVUzoRdMXrM CS1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jk2q0vcmsQal+f6x+Cquhd7qqcPP2pmdgxYTFHEijJ4=; b=qwuR67/cBIM2wP8JIWZbQfqmBo8utbN6xfWaZfGXn8/xs4w5XThCgnPhxfxgU0SVSg KMDWj7bAkiIkMNFDGnReatKe+gx7S7WlnycEVFLN0mtE4gBB0vs5QhUOjD3vorBxnoCJ ZxMvZVWnxZzKYiwXj0+LJG+8HasfnpEMV96yOExC5R8Q6A9MSnGI5zMPz/+Yx/d76vSp Q6eLjRY89KFueDfl3RghMr6Os5DqMfoDMkIeKlQWQr6siKP6tzOIvC4rGLq1gNW8uUJu HMW+3AYGHGpdfsAoynne8NxRmvDT4/ESqe/R5ViqfbcjJOsF8JDlhhYt0ZeRaqL2iwT0 JAZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x3N5WOGb; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz6si16420285ejc.610.2021.07.11.23.28.58; Sun, 11 Jul 2021 23:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x3N5WOGb; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235128AbhGLGa4 (ORCPT + 12 others); Mon, 12 Jul 2021 02:30:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:48364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235754AbhGLG3b (ORCPT ); Mon, 12 Jul 2021 02:29:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8EEDF61152; Mon, 12 Jul 2021 06:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071147; bh=rVTEBYV/NdP2iHYnDyPZKAXoUnLWK8flw2crnEhDh2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x3N5WOGbBnQH7G/qeV+fiMMnFg0w1q23kwpnlLmDBsR6nUQpZrNjOpL2CKjD8gzYJ b1LMCHiwy9lF2blgNDAe3kexDVqh78yDaTinYTqMytJPua+WwIrZJI9x3TJnCXfO/Y P/p1WnY/PUL9/GUU0bNsIidbx7u+GQ3Iy9X/KJVU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kalle Valo , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.4 257/348] mwifiex: re-fix for unaligned accesses Date: Mon, 12 Jul 2021 08:10:41 +0200 Message-Id: <20210712060736.942033020@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit 8f4e3d48bb50765ab27ae5bebed2595b20de80a1 ] A patch from 2017 changed some accesses to DMA memory to use get_unaligned_le32() and similar interfaces, to avoid problems with doing unaligned accesson uncached memory. However, the change in the mwifiex_pcie_alloc_sleep_cookie_buf() function ended up changing the size of the access instead, as it operates on a pointer to u8. Change this function back to actually access the entire 32 bits. Note that the pointer is aligned by definition because it came from dma_alloc_coherent(). Fixes: 92c70a958b0b ("mwifiex: fix for unaligned reads") Acked-by: Kalle Valo Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/pcie.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.30.2 diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 58c9623c3a91..bc46a0aa06eb 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -1080,7 +1080,7 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter) static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) { struct pcie_service_card *card = adapter->card; - u32 tmp; + u32 *cookie; card->sleep_cookie_vbase = pci_alloc_consistent(card->dev, sizeof(u32), &card->sleep_cookie_pbase); @@ -1089,13 +1089,11 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) "pci_alloc_consistent failed!\n"); return -ENOMEM; } + cookie = (u32 *)card->sleep_cookie_vbase; /* Init val of Sleep Cookie */ - tmp = FW_AWAKE_COOKIE; - put_unaligned(tmp, card->sleep_cookie_vbase); + *cookie = FW_AWAKE_COOKIE; - mwifiex_dbg(adapter, INFO, - "alloc_scook: sleep cookie=0x%x\n", - get_unaligned(card->sleep_cookie_vbase)); + mwifiex_dbg(adapter, INFO, "alloc_scook: sleep cookie=0x%x\n", *cookie); return 0; }