Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp105688yba; Mon, 20 May 2019 05:48:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5iz7GxPg3tS2+zJQ05/WzOBr/kAz+5YcwIkpPjVqKlHsSGyYqizEep1YgzDQazCs0qtAi X-Received: by 2002:a17:902:ba88:: with SMTP id k8mr1886602pls.16.1558356534080; Mon, 20 May 2019 05:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356534; cv=none; d=google.com; s=arc-20160816; b=zk5yPDqYRWTU4AZjtoOodTMuugra2ntFdFAu6dMdWcLT/l5sxNQ8/2UO8gCM5CzomF oSUw5eQlqRf1kR+AkeOP+Z328gmR1XKc3mo3lqbcGWJRatnWx3AVwoLgmUTaVE8UutfK 17KbL5V1Eugntnpp4+E7n/rpzizvwhRjkZQoaVdLN2b8NwhXLRJ80gjh2Dod2SEV/M2O nYCPtTJSbXtuCTRlBdLaZ3doYJtfbNYm/Z1Q5Llx9e3ssQCWoeen67+1CrNUmTpFKbYx dBP2YGruBJOmb5ZdJoWdQyuUQRuJiT0mvviUTZQKtSvee+MEQqViz11lgCD7h3dUDoAP EJKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nenue0ngHZu60Z0TxQ+iHjaMa+2r8HQgUkopxPvixu4=; b=ap+QgmlC3bAq1WgPUuXTPDJiHF2wRfbj56EHd09FsZc1ghQRRCtI4kMJzj0XJkCwO8 n8bpVSqFUZ/Al3tggQZtiaaCoFe3CVstNTLFTr1Gk53mI47PL6PYthC/1oCpoOia9Ywt aChT6ahGS5qy3WPFk147yzD43CMC31st+LnPM6bkhAuTpFdXq349m0pYH4xYhjevFDRD itpkq+8cpWMNWXPwmNnrrhI5PUnTd9JigIo14j3SgThBV0XZtHzG7SdVOb5eTJxdbNiy BesvtB+vTuUFR/g2qwXhQcIgN7QSGUzmGGH6z8HBn5D62+j5R/qAURkKgmdtu6j1ma/e rimA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SP8nQ3uh; 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 m11si16932661pgc.244.2019.05.20.05.48.39; Mon, 20 May 2019 05:48:54 -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; dkim=pass header.i=@kernel.org header.s=default header.b=SP8nQ3uh; 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 S2388997AbfETMZJ (ORCPT + 99 others); Mon, 20 May 2019 08:25:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:40112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388989AbfETMZH (ORCPT ); Mon, 20 May 2019 08:25:07 -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 4DA6A20675; Mon, 20 May 2019 12:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355106; bh=6RLYkUuvGgMflWixEZkW796FKXNDlG8rxgC9dmlFQsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SP8nQ3uhsMx1rTD/zjNt5Yy5h8U6G4jRYmc886oas5QgiJkmsNmqSj0rjwsQBmAmr WXhLr2PriIhc2lmElj9mSE44f66v7SaE/gAzciidTJmMdPWzhj/qSAoEU1IQNFN8YG ooIeiBUcRKCkTOEKlmYETx/ccCbl8rkD7haa7mM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sai Prakash Ranjan , "Joel Fernandes (Google)" , Kees Cook , Guenter Roeck Subject: [PATCH 4.19 100/105] pstore: Allocate compression during late_initcall() Date: Mon, 20 May 2019 14:14:46 +0200 Message-Id: <20190520115254.135611751@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joel Fernandes (Google) commit 416031653eb55f844e3547fb8f8576399a800da0 upstream. ramoops's call of pstore_register() was recently moved to run during late_initcall() because the crypto backend may not have been ready during postcore_initcall(). This meant early-boot crash dumps were not getting caught by pstore any more. Instead, lets allow calls to pstore_register() earlier, and once crypto is ready we can initialize the compression. Reported-by: Sai Prakash Ranjan Signed-off-by: Joel Fernandes (Google) Tested-by: Sai Prakash Ranjan Fixes: cb3bee0369bc ("pstore: Use crypto compress API") [kees: trivial rebase] Signed-off-by: Kees Cook Tested-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- fs/pstore/platform.c | 10 +++++++++- fs/pstore/ram.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -786,13 +786,21 @@ static int __init pstore_init(void) pstore_choose_compression(); + /* + * Check if any pstore backends registered earlier but did not + * initialize compression because crypto was not ready. If so, + * initialize compression now. + */ + if (psinfo && !tfm) + allocate_buf_for_compression(); + ret = pstore_init_fs(); if (ret) return ret; return 0; } -module_init(pstore_init) +late_initcall(pstore_init); static void __exit pstore_exit(void) { --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -956,7 +956,7 @@ static int __init ramoops_init(void) return ret; } -late_initcall(ramoops_init); +postcore_initcall(ramoops_init); static void __exit ramoops_exit(void) {