From patchwork Mon Jul 12 06:10:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472908 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2660966jao; Sun, 11 Jul 2021 23:50:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwpPbPBKdJf4BJmZe5PAZf/xFJ+ftby0XPK8rZxuJYz06JDED9iKhzKmaJreJfr3vW5x1B X-Received: by 2002:a05:6402:2206:: with SMTP id cq6mr15198688edb.209.1626072656316; Sun, 11 Jul 2021 23:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626072656; cv=none; d=google.com; s=arc-20160816; b=wQqmKP1HEg2IYPZLloitceDwHgzYVni1c1VgVBcRMBGY/FVH5WfPia+kfovcTe8zSL OneoRhdfvouTzAUI25y5ropsyXB1EMMZJti+aj/7nGxLiS+bStkrkBpFXTAOVCzzIGFs BdkvRDkHF36sbPCNtt6Zi+8NZ9RON29QysbhYDW0QTp+1jUhUseVTx8upyY70O11jiI5 N8yYhQ5YP9NdUQosUFdiUVYiW4EFCIvTHJj0FZqrfquvum5pdCD/fv+J0kP3akwUBlEI OSxyajKnsuy4cOSLeT+y2ru3oNyZVq1w+IuKCxUTudubnoSyhpgFc5AkcKPz3/t9bkR1 aAFw== 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=Qkl0A2RYS9Hf0OtxU44BDQ/MK4qwSos1xaRFfxeejkM=; b=LajlhV5dHrhO/gOsoP7kCsRQ23CJtZLyG2735PDY696jl3q4MOxIcbwdYQv9BEi/Rq k5SGQGviy/fUu5osV6hFhIwTVIsRj0ArlEJpvRHPzhJQRauYD8mKz2xRmdpS1D2kOVF1 ogmGnI1JJnRyuVNfZcJDFFQqYhYFAHCY2Zd8u8GgGF9iDBi8c5bYB/cwS+BhxLo7qfm8 l7O/T/0Ur5z/qrNBzdYv0mx0/SdbtEjxJK5vYpHKhHETJTrTKGlyfX1Lyc4uMWD/7tFX w9v7dkFWCL3wkUQMCi2atr1WlfxkQpNIJqCunrrIgNywlrHSGARIEnYx1AdniJIwosmO FAvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mxqp2PZn; 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 r25si3440466edp.437.2021.07.11.23.50.56; Sun, 11 Jul 2021 23:50:56 -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=Mxqp2PZn; 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 S239785AbhGLGxB (ORCPT + 12 others); Mon, 12 Jul 2021 02:53:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:49190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238679AbhGLGtN (ORCPT ); Mon, 12 Jul 2021 02:49:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B62FD611AF; Mon, 12 Jul 2021 06:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072302; bh=+BaG+O+HH2eqv/ZDX0AipjN2/iaq3ltAmZrXeJnTILw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mxqp2PZnf4yiQTLGXJ+28Y7d/6K56Ip//72cbKL/GaPe2g10oih9yxNOOuOgFlChh v0zbiZKVdeTYiFBsJaremGMuKGH6ls8MVzy4FRkuNVfsRb/t1ol98ArpTiYsaGlFyE boVaHEvKe37ogxSRjm7V6PDWZ9yyYKz7sQ5aia1g= 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.10 441/593] mwifiex: re-fix for unaligned accesses Date: Mon, 12 Jul 2021 08:10:01 +0200 Message-Id: <20210712060937.372889464@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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 33cf952cc01d..b2de8d03c5fa 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -1232,7 +1232,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 = dma_alloc_coherent(&card->dev->dev, sizeof(u32), @@ -1243,13 +1243,11 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) "dma_alloc_coherent 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; }