Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp648276pxb; Tue, 2 Feb 2021 14:18:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqcsg6yP5FzydcyrEjB78GVPrBKrA4Pkf1aTVioHwjNwuMROQLC+pQWaxe69cKaL3aHAMb X-Received: by 2002:a50:b742:: with SMTP id g60mr210116ede.113.1612304292360; Tue, 02 Feb 2021 14:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612304292; cv=none; d=google.com; s=arc-20160816; b=Oj9BylRAsrm/N7RiT5gUyXmRIWX9Y1L0K53OCZKggzb+PxUht6tNAU6USyUN3olvE1 RhO9zTJndoW0bOe3JZO7zIb6lm/xtnaOvjidmkQdw9Bf7Hs2wyYuNXySrZNUT0UdU+iX xRkKcISur5fUcgj/AOQCK5DWiMXE3aOmEwDwG98D+7HbE2LQ13XDfF0UwE3tN3Ez+jYU qOMwU2HEJOm62NtQVPkxQvFDIX2QreMaOcdDtDuPBEHvOulUVUjOBjbtCG1uny/0141v KLT0pRoCy8oVNX4g7enETCJNA5knIgfLUAhFc30YLLyAyX1ekwgGbnUKMyxnKSrsWxIt JP1A== 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=k8Up3KvTBnXFm5yU1vUyfOBZTcnMDBPwfHPX9HIjif4=; b=edCX7ChYKJ8H6nJ7TYawdJj4VxXFUF43iQh8tJnpYuRvHWoHCGU5TSmOYZFTl9ObPh 5vXJOElc+30YKoKDt5xA979ABFI71d0T+XQGpZVIBak1cu2RD29DCeoBmINfArWqCjSx rXdrfA5N4qtBLg/e1f8L00S6CCxyYEosGWKTHpeFA/uUjQHVpogNfZfNwK6cATujA2il DmmpCV4v8r4aaDqMBePT1wFkSZs9Pzgm7PyQ3E1RW3j8dClybG7j/3ra4qdn8RW2Z4Qr AOlX+kpfsviuwz7Xmb9Zg1PfixG8JaY+Vu/2bPvkZqhvD0ILS3JLM+G9mfTHkXsJ0im/ /8ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r1Xqon1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 h25si116053ejc.182.2021.02.02.14.17.47; Tue, 02 Feb 2021 14:18:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=r1Xqon1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S233468AbhBBN52 (ORCPT + 99 others); Tue, 2 Feb 2021 08:57:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:41110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbhBBNvy (ORCPT ); Tue, 2 Feb 2021 08:51:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABB5764FC1; Tue, 2 Feb 2021 13:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273421; bh=00jMgK71EBqH318TCdADuv/Lgi7WByMsOAr2jRw0HGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1Xqon1hIH7nOfggHKrFqovWd7IMfEdVhSYxj7ZSISorkyYiCmZydT6gFEIHJ9HR6 /YEa90suN6DFphmNjtVnVzNJOr/4lxbQaWQBFvH1t1t5liTIrsf24KfQioZlg5L5oi VK3Ep7d2jLmFVsHxbdwQsa8qNdCmoxYtzAcM9cV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 100/142] iwlwifi: pcie: avoid potential PNVM leaks Date: Tue, 2 Feb 2021 14:37:43 +0100 Message-Id: <20210202133001.837635827@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 34b9434cd0d425330a0467e767f8d047ef62964d ] If we erroneously try to set the PNVM data again after it has already been set, we could leak the old DMA memory. Avoid that and warn, we shouldn't be doing this. Signed-off-by: Johannes Berg Fixes: 6972592850c0 ("iwlwifi: read and parse PNVM file") Signed-off-by: Luca Coelho Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/iwlwifi.20210115130252.929c2d680429.I086b9490e6c005f3bcaa881b617e9f61908160f3@changeid Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c index 5512e3c630c31..eeb87cf5ee857 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c @@ -341,6 +341,9 @@ int iwl_trans_pcie_ctx_info_gen3_set_pnvm(struct iwl_trans *trans, return ret; } + if (WARN_ON(prph_sc_ctrl->pnvm_cfg.pnvm_size)) + return -EBUSY; + prph_sc_ctrl->pnvm_cfg.pnvm_base_addr = cpu_to_le64(trans_pcie->pnvm_dram.physical); prph_sc_ctrl->pnvm_cfg.pnvm_size = -- 2.27.0