From patchwork Mon Jul 12 06:10:11 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: 472962 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2681136jao; Mon, 12 Jul 2021 00:20:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgJNDf7sfsjFgZg+oTBvSRlH7SpfLwOIRvYRQlso/Py+eDL6pol5ubFh0jDXXBnYLo2bc1 X-Received: by 2002:aa7:d4c2:: with SMTP id t2mr34035434edr.92.1626074448924; Mon, 12 Jul 2021 00:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074448; cv=none; d=google.com; s=arc-20160816; b=EHQI4QP9RbelOQkkx1XtVKu19vyBOZmChqXx/uH6Wof6xaE0NtD75r7ABcRi2exXuL RJqtTbNgahO8524zaTLI5WXpii6XTLqnqyQUtSID7JgTn2ubZm3GqQpXsnkTf/nzJkP8 YrS/JceJKBGG3VNLEPin/kOC5JAtngUQB/TKYUVm9W4kkiv+6lteWevkJcsiQaasiElS uKwlJV/e1pg9OzilI5WC1nsAvdhxAyWqdHbkvhlCejntP1u1sRkpXXEFtmkgsz336new e+4Obkp0I5tz03oZZoBJz1n3gOFJYkXH4xUVdEtr2r2N0f9wgymCKoYhkwk18yc2evga Azaw== 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=bsjiOmMcKt+l0fOX6dLYezQeE9sdhdRjq9w2+2KHU+e4v7JOoueSJgNjkuwS7eXITG q2l3Ix8mrcE/ahQSrLq7hFKsFEChTUKWZZTnifm9yl2e3o49HWj1No4DwCDRCnVYrL6G QvnAU/I61ZUnL3w+v+2I3dQC+s2ZrprTzHBY2SeLIyQJkTBzdqczhAR7NZ6LgQDs8tS8 AccU82svfimCh9yytdnFcuMNCznUtD8aHU/gphQWcOh8pHX1tL+kkaHum8zpm/isQw89 jAaU4iyBX/o3/pQdpbsLnJeN44BbqkgiUltX45ofsumzD0hNTaY2hRPuNqj4KCuXXVji H87A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CL25UKn6; 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 d9si16909677edq.169.2021.07.12.00.20.48; Mon, 12 Jul 2021 00:20:48 -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=CL25UKn6; 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 S241384AbhGLHWT (ORCPT + 12 others); Mon, 12 Jul 2021 03:22:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:58798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344847AbhGLHU7 (ORCPT ); Mon, 12 Jul 2021 03:20:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 16F65613C7; Mon, 12 Jul 2021 07:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074290; bh=hmRurIbqpU3suHtsvoRkZjjK8IEUMAk/gBQlJcPZB9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CL25UKn69HhMUdjbpGBgIRRlIeJ2h7mnj/5eeHIKROR23SUTXZsClBMDkS8qKo9UV +REAxUqOdydkLV7Z2ekVAp+ev02eWwejkfHzqJbJUCpM961qnH0NlVANk64ey1My3i IzJMDtoZ/uJiVz8+8vbLOPjlcrHNEl+MATb6XOgg= 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.12 528/700] mwifiex: re-fix for unaligned accesses Date: Mon, 12 Jul 2021 08:10:11 +0200 Message-Id: <20210712061032.725217517@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@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; }