From patchwork Wed Apr 22 09:57:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC3C2C55189 for ; Wed, 22 Apr 2020 10:14:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E2692076B for ; Wed, 22 Apr 2020 10:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550455; bh=5L12vHqEHOaC7r0soFuYDqTeJHuaOYPdWwuR3ACjprM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qfz1puavNMUJrW453bNMCzE/kRqOcxCbmyRsravc8KmG/KkSZRZYxIoW54CbCEUJ/ O/5Je1udWR4IBOoOk9+bmIRd9mlHkxX8mqMkyeZG57qIP9zp23ssascoOtvfvK2/7N 4J0yqhSBxKRYxPdoZFOMG5uAVMep52gxFNZ1Wyto= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbgDVKOO (ORCPT ); Wed, 22 Apr 2020 06:14:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:48548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729484AbgDVKOL (ORCPT ); Wed, 22 Apr 2020 06:14:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CAB412070B; Wed, 22 Apr 2020 10:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550450; bh=5L12vHqEHOaC7r0soFuYDqTeJHuaOYPdWwuR3ACjprM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0yC2cOU/1o/HD+7hfELMHAFqh42QOojVdWSWwgOwU6kjZmlP4BEPtyda53iwldcfk 7oaD6y4OJgPnCfGmtSGM9hR5Vruq3tAMRRVcQnuct5XINIQTODaD+Fr4HjjyFuknA+ F5hFNqaEntzezUT+41W1U2LblQzf+/DVoOSoqX7Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Tianyu Lan , Wei Liu , Sasha Levin Subject: [PATCH 4.19 22/64] x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump Date: Wed, 22 Apr 2020 11:57:06 +0200 Message-Id: <20200422095017.076629957@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095008.799686511@linuxfoundation.org> References: <20200422095008.799686511@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tianyu Lan [ Upstream commit 7f11a2cc10a4ae3a70e2c73361f4a9a33503539b ] If kmsg_dump_register() fails, hv_panic_page will not be used anywhere. So free and reset it. Fixes: 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic") Reviewed-by: Michael Kelley Signed-off-by: Tianyu Lan Link: https://lore.kernel.org/r/20200406155331.2105-3-Tianyu.Lan@microsoft.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- drivers/hv/vmbus_drv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 5ff7c1708d0e7..dd6d18d918a4b 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1222,9 +1222,13 @@ static int vmbus_bus_init(void) hv_panic_page = (void *)get_zeroed_page(GFP_KERNEL); if (hv_panic_page) { ret = kmsg_dump_register(&hv_kmsg_dumper); - if (ret) + if (ret) { pr_err("Hyper-V: kmsg dump register " "error 0x%x\n", ret); + free_page( + (unsigned long)hv_panic_page); + hv_panic_page = NULL; + } } else pr_err("Hyper-V: panic message page memory " "allocation failed"); @@ -1252,7 +1256,6 @@ static int vmbus_bus_init(void) hv_remove_vmbus_irq(); bus_unregister(&hv_bus); - free_page((unsigned long)hv_panic_page); unregister_sysctl_table(hv_ctl_table_hdr); hv_ctl_table_hdr = NULL; return ret;