From patchwork Mon Jul 19 14:50:08 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: 479893 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4225461jao; Mon, 19 Jul 2021 08:21:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqcntYAqAUb7pVrsWx1O0adTNEGb7K5k6h/zK7FVNPC7l6hfHxHPigDm9NYMxNDujqhHBE X-Received: by 2002:a17:906:c107:: with SMTP id do7mr27899599ejc.469.1626708088057; Mon, 19 Jul 2021 08:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626708088; cv=none; d=google.com; s=arc-20160816; b=CTnFq30rJxbnqDhJF/3JhQYMMYo9IVkXQ9jp6DU/5X/qIpkEu0WOLJmhX5KrNalYP7 D04dXRJi/XOAUoAGsXXs/8AGN0z3h+GyifZgH1A/ADIapOlQoF3GiKDeuHU7Eo5OJBcd UFk29QVGftjAWh/oUnAAQbqoNanQUOCaL55qxDPvs0iUNHK2UZPb7CtuRRAf6i54iMAa xse/b9Sq8U7BpnFNf3AZoUqWbSiyNoqTBu5TYXjWQNWqKavt/c1uF3a9CYEshBbXaYiC NldvMkaFZ7JWqRrN1lPYIjgLPTWkrGbtrxNBZk+59Gsu+GdgZQJip/RymBCDll+ssLhy OVTQ== 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=jEsXvWUzroedSlWRfKtto4fIkehKax4L3z04LonZ/vU=; b=A41nOk/XUrTbQUb+uUiWLVGt/StPw3dXwrn8Zi3ST6a0JuoAKa4B0EnRjHLBDm9OCV btYvrtt6sQAgTVwqdWwfTIMIZMYdfUpdzvmHpaqtCp6mK31vbbX2SWf3SBxjjLE0oDYk 6O2TWUgVDAZj0EJlUwOCIqtnfFNK83bMrqzyXBeSlxyjmx3Zfpo6Hvh1L/hqPVhUPA14 lg7UVP/jOACzwPjFsPtYJ33gJnYETPR6obI9nkuZD6Cm7yUnHEWlrDdF23ZQAzi5FoBd 0AJJ6s01ou1RIErVcHLRYJP5fKk4+L3dc88j7uSiuviL/HT86sdlPHxj3cbw7wCjYrQg X01g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OnmJw3mj; 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 l3si24719878ejo.634.2021.07.19.08.21.27; Mon, 19 Jul 2021 08:21:28 -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=OnmJw3mj; 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 S243811AbhGSOkg (ORCPT + 12 others); Mon, 19 Jul 2021 10:40:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:54384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343585AbhGSOje (ORCPT ); Mon, 19 Jul 2021 10:39:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 887086135B; Mon, 19 Jul 2021 15:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626707945; bh=D8BXHcIXHA4M2KU5OCnPId8v/LQQk0xGA2S5lcpYDm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OnmJw3mj/EUb5dyqyCep2aJFICOVAPmcpWjECR2RVm0DZ72PxNWQyJzQKvmK9B+vF W4Rn3EDSo40YMjPMzDg5vlvOyhkYQHRa0Unj1Y1HcarCKlsFjtB/isPMdvD0F/yl3c m0/G7RWzbrP+cFrRj4DvpyQ+nnzgEFZLIwtZvnLk= 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 4.14 119/315] mwifiex: re-fix for unaligned accesses Date: Mon, 19 Jul 2021 16:50:08 +0200 Message-Id: <20210719144946.784540123@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.861561397@linuxfoundation.org> References: <20210719144942.861561397@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 7f615ad98aca..5b12d5191acc 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -1070,7 +1070,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); @@ -1079,13 +1079,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; }