From patchwork Fri Jul 26 23:52:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13743569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E9C1C3DA4A for ; Sat, 27 Jul 2024 00:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Agw1NDopTbJHSwXqEMTAoK1oQKqohLcT4CyuwhV7hPY=; b=sNDo12ZtyyaHRupYzGmuDUmtOY HBfjQMhu8Jrxhd+wuKk4fMFPuAy+u+p2OPhlVBAoIK15R9lsK9ZuRiN9kBCupq+rbTdUXiwSKIZA0 WU10v9JFvCJ8pVQC7UEjzitL/Q5OZkAwL8rVYxYS2bXrDJODmv8ghxpC8M/JxV15acAwjiRSaRa/7 8M18odXyKOKip9e5mgg1n/NljlZhFfG+7i6lkYXMqzWdnxDdUBbxL1AQrIUNPpsbC0+kp/9FJNBye NCKwjlMDYw9uvlG3phJ2yIfJ/4bp6e7yqTYiP5R2c7ocX8yVez8ih8PgtG+sXXxPm34Bx0gusXiHL VMglcwDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXVK9-00000005iq2-2T0P; Sat, 27 Jul 2024 00:30:13 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUmD-00000005RBX-0A4d for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 23:55:13 +0000 Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1fc5f04f356so10599555ad.1 for ; Fri, 26 Jul 2024 16:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722038107; x=1722642907; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Agw1NDopTbJHSwXqEMTAoK1oQKqohLcT4CyuwhV7hPY=; b=e5nexWDcr74v5Ti+MHQB4qjptT5ei7vIlrzAr/Qats5fQWJ6muj6YMibrXTH1JuHLA CilAF1jvFFBK601Uj17+v4Hop5RaH3v+5fezi1IDydkh6M40E6jAp9W7XW/37ify7Ku/ 4vfnxbHPWWQcWE6gDXYEm8C/qAxl5N7AvN0JPkrjlDtT8LzFXm8uFQVXMYbR04g13rpB QgHju7F254xreGdDdluFS2IotbeSJj2+usRAviI+RsPVGgBNQFgqxyolgp2blecAdpMO qn7diiJtaqtUaUvskluWkfj9Cjzc4TBeas8RtEQ9OY/gXS1qPYFZ/mz404XrtnrLoB1r DqbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722038107; x=1722642907; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Agw1NDopTbJHSwXqEMTAoK1oQKqohLcT4CyuwhV7hPY=; b=rMaADb5q5lK16XX0xyQmE8JK8mxbmZzCgQ67tZBObFvSr0lnkfXj9ws3DkPmnUC/Re OWSboreoTKdrd+qmGdQqnS5ITjFHq3DqvyQ4DxPP0ouLzPHY8lw60j004C0nOnzzVy7W PQ/Vks6H1PUHn9KVBiP62bsbLIC4kEs4YPzeGCZ+HRGfcRWjHUydOYmY9/qvD0jJD3m2 2PnjmLf9gLmraTD8IOuQ4HFoJnJQ0AMVSrO12XkWaM5Rv1mWZrtKY+3g99bn1wagv0tO VQhAVHsd6+AIhj9+sh7ZnrnXmtZ8UKciD6TA9j3R0Vblg8QF1HHt0YY9dWbHynbK9gjA yjUQ== X-Forwarded-Encrypted: i=1; AJvYcCVGu3KU4qR7xqROGe9V8gtBwGOms5Cjpi56ieN+VKg2qTsRInNQo8GnxcmPeQd1Jgw6IqwcCt4uVwxvn72+0qwUolDcdlfRZWQ9NR6PhYvzdhCnCdg= X-Gm-Message-State: AOJu0Yy5Y2fKldzLr7y3fUooCrIXGsrJTlsEcPvvVAyosJatAvpcN02z mzasy5ilgqG0Ds5+cG0QhzMqJ/VztFrUl4ZNaxungrU1nlPjQNbI94R5O43xTzO0zB7I/PnzlME OOw== X-Google-Smtp-Source: AGHT+IHxZ9LAKt5vIHU7V05HDfJ12gC6skwH/WeW9XOXHpR7B1c0ubRWlOUtq2UiALskA4rClXraM4lFVDE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:b18d:b0:1fd:8ebf:672c with SMTP id d9443c01a7336-1ff047d8f61mr25415ad.3.1722038107293; Fri, 26 Jul 2024 16:55:07 -0700 (PDT) Date: Fri, 26 Jul 2024 16:52:21 -0700 In-Reply-To: <20240726235234.228822-1-seanjc@google.com> Mime-Version: 1.0 References: <20240726235234.228822-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog Message-ID: <20240726235234.228822-73-seanjc@google.com> Subject: [PATCH v12 72/84] KVM: PPC: Remove extra get_page() to fix page refcount leak From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_165509_304226_835D0FF5 X-CRM114-Status: GOOD ( 10.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Don't manually do get_page() when patching dcbz, as gfn_to_page() gifts the caller a reference. I.e. doing get_page() will leak the page due to not putting all references. Signed-off-by: Sean Christopherson --- arch/powerpc/kvm/book3s_pr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 1bdcd4ee4813..ae4757ac0848 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -652,7 +652,6 @@ static void kvmppc_patch_dcbz(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte) hpage_offset &= ~0xFFFULL; hpage_offset /= 4; - get_page(hpage); page = kmap_atomic(hpage); /* patch dcbz into reserved instruction, so we trap */