From patchwork Mon Jul 12 06:10:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 473046 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2714116jao; Mon, 12 Jul 2021 01:11:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwMc0Nxo/4ykhLK6Ppq1z6VPy0Vf9kKS8QgzPu5Vjzd30ViJukygRNVjmOpSS9jQ5Xi5yU X-Received: by 2002:a17:906:c006:: with SMTP id e6mr51873200ejz.510.1626077482239; Mon, 12 Jul 2021 01:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626077482; cv=none; d=google.com; s=arc-20160816; b=DPkqMRnApxRJBaZlIIxqHstxPyedjbdljFPDyJ+xGC5abRYvRnrDVgngG4uHdJrqwx cje0/UL8axtx5qUMZudPt5IdUeBzgRqGnTYmgSF0NFOA9m1FHt5r4pOUfU/j7jkXTVpb f495Yh209ml6v/CH4udfV7y5v9WcC2f4QOko+1p4kvejH1/20r0UDEYQ6QoX518esOh3 Ay6Y3Dx1fb2TDWemsLSWUl53pTR+T5vzPfpMAV3c/FWZNKf/uFONYuHNStNsdPFTt75t VqY+3l/KYSu3w63liPLfOd65KKl5b703wb0XPETd9s/9emh4j84yW4mpOGt8mEq9FORD 9z2w== 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=gnu19m6a5wngpl8dAk2eMS9jLLnJHQ21P9+puU7fypI=; b=pf3rw/U9FnFEwyWlNkjl8S8/9r/TTMMstox3bXjYk4kJm08xJeayQ2tWQ+kzVYXT0c QDXh/k0Sf5Sf4INTRbGNYXTZ4YjVNhzXRMPhBetDBYdhYjfN4RJlXR2mdXbbWvEjmo8A /spUSSXZwaGYuEXIFeXLwI4s0m4u8nCjQ6koQT7gPBRwdeI3OyVPv6LmFHhbO4rZYsTd kiuIl9LqrR3PY1gRN3DU4SLMfnRUvBbwvdJXmYZXby1aQ9mZVuEsbHfFsjpp7k0rwZb6 4gX4AOyDUx9X84Eng6s5oixnsf74S4Nq3QKCRoo/636e3YMdsvsX6PN7YgiFbbtGtfII eXrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BJm+7aDf; 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 n21si13642925eda.13.2021.07.12.01.11.22; Mon, 12 Jul 2021 01:11:22 -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=BJm+7aDf; 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 S1353383AbhGLIJW (ORCPT + 12 others); Mon, 12 Jul 2021 04:09:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:55676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352872AbhGLIAI (ORCPT ); Mon, 12 Jul 2021 04:00:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0759F611AC; Mon, 12 Jul 2021 07:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626076428; bh=hmRurIbqpU3suHtsvoRkZjjK8IEUMAk/gBQlJcPZB9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJm+7aDfqsCDGptdDgxigyQgaE2cwoHLJcuOlXTG1tpLDTEevt5uF3KATGf3QHpL4 GAQAaqxr4HXarzh3hZTyrRgU6BR6pSMX99l3t4JXnfmbWDv6s5DvYMY3ykMqhRoPlU p8jZq/2eGnz1jglUQrnOy9XOKDkgp9DKRraT6yGU= 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.13 612/800] mwifiex: re-fix for unaligned accesses Date: Mon, 12 Jul 2021 08:10:35 +0200 Message-Id: <20210712061032.348945061@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060912.995381202@linuxfoundation.org> References: <20210712060912.995381202@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 94228b316df1..46517515ba72 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -1231,7 +1231,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), @@ -1242,13 +1242,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; }