Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3015642imm; Sun, 1 Jul 2018 10:20:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIeHMfTI/aYbRvywsBHzsZ8rY41UjsKwpThgTpD/maq0kc11JbNE25nz6yma0rFOCCj2lEk X-Received: by 2002:a63:9246:: with SMTP id s6-v6mr19390197pgn.35.1530465640137; Sun, 01 Jul 2018 10:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530465640; cv=none; d=google.com; s=arc-20160816; b=Sry2m80K4hXIjbxVLFROkAvNc76v4A7fP7F9U9Pvgsz8QBrYD+cnt5AQBTc8A5JFLq ohsoRmQWdYEbuNYQRa7O4PMp21iwTez6Efxqv5BK6iPZf2CXNPVJRTTgYB2g/T2V4FG/ L3Xj748UPdAuSb35Egk/H3+/urKCxt6Unm+ayqk+PHx6ccUz9BXkx57aCAokjBKSx91o Cc5aDJPc7D98cCavxyX+55rcUinQGjlbKdt9bYcpCWsgy8Tw9jljK0U32YLTrKuhqkL3 YFZfRJHMcpVNWOanzK82n5VP9na7x/tmOihZ54Fp21faGq40MKXiojLikwkzgqU+u9dn K8pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7Mut//olY/cmfR6YIAxMSwzVYR9q91hVnZEjUJSDLbw=; b=O4MdnTedO2rQa4j9jPxYfyZ0h0hv1DZXzluW2gmZjo9Ds9kaYDw1b81vRXBZB9BNQ+ DZ2xTY6mh3u9weXWNhnKbG9f/SZmF9rcUkq9yk09xTXQlalCaAokjYWm4APhXXO+6KkB Gyuy/AdFgnn+fBVoQrsktozK2dosOE9kMr35ag+DlzeYuys0YPVc8EpzZhsdR31wtav5 4N9a75EDwtyvgauwqh2Ic5ts10d1FSWw4kgAnTYRnOiF6su50KB8gn0XbQhbH8Mo5IBC AzoY40kxFlq1MIpo7j7tQ8NuN/qOm+GElY65Tpw+aGKrfHSP+ESd+Zjx6W/1NM7+etLn f2CQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1-v6si12619207pgs.221.2018.07.01.10.20.25; Sun, 01 Jul 2018 10:20:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031634AbeGAQir (ORCPT + 99 others); Sun, 1 Jul 2018 12:38:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36756 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031365AbeGAQij (ORCPT ); Sun, 1 Jul 2018 12:38:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4C3E6AA6; Sun, 1 Jul 2018 16:38:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Michael Ellerman Subject: [PATCH 4.17 049/220] powerpc/powernv/ioda2: Remove redundant free of TCE pages Date: Sun, 1 Jul 2018 18:21:13 +0200 Message-Id: <20180701160910.374741835@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Kardashevskiy commit 98fd72fe82527fd26618062b60cfd329451f2329 upstream. When IODA2 creates a PE, it creates an IOMMU table with it_ops::free set to pnv_ioda2_table_free() which calls pnv_pci_ioda2_table_free_pages(). Since iommu_tce_table_put() calls it_ops::free when the last reference to the table is released, explicit call to pnv_pci_ioda2_table_free_pages() is not needed so let's remove it. This should fix double free in the case of PCI hotuplug as pnv_pci_ioda2_table_free_pages() does not reset neither iommu_table::it_base nor ::it_size. This was not exposed by SRIOV as it uses different code path via pnv_pcibios_sriov_disable(). IODA1 does not inialize it_ops::free so it does not have this issue. Fixes: c5f7700bbd2e ("powerpc/powernv: Dynamically release PE") Cc: stable@vger.kernel.org # v4.8+ Signed-off-by: Alexey Kardashevskiy Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/powernv/pci-ioda.c | 1 - 1 file changed, 1 deletion(-) --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -3642,7 +3642,6 @@ static void pnv_pci_ioda2_release_pe_dma WARN_ON(pe->table_group.group); } - pnv_pci_ioda2_table_free_pages(tbl); iommu_tce_table_put(tbl); }