Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3253855ybi; Fri, 5 Jul 2019 04:28:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyT69eAEW3XFHVV20y85hfZH2xj690y7ClPkphe3z5kblB0XwUaEqzcCrvBbhmWDAQuBQlK X-Received: by 2002:a17:902:7083:: with SMTP id z3mr520583plk.278.1562326111332; Fri, 05 Jul 2019 04:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562326111; cv=none; d=google.com; s=arc-20160816; b=RgcPogH35ZcfZpxXYs8kbAD8+moY6otYff2bJmKEmlliSwI/F0r43XdNZ5vFPgXmPF vPeB6jR0h68K203uHsgzrlAFnD/hziv6nKXV968gpXARKX+acd3F/TwMNQwAGyaEi243 Dqqw0mQGZEv9kkY6t5ahcvB6oz+zn/HmyXcAp28yOCvPK64pjbjKVwesficmOQ43RDPF /rpjllrNdIvrCjy4h0PqsZnVKT+rA8f1VmQIjE6PWrPMPAh9aShqOSiFcVQtMoKvhapZ Yo3fhb/ZTirO1jiz+qANwD9ChhIzen0YayEj2KQcCD1cFcNgDLWL5/Ywhx9t362DCJHK M/5w== 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:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=gMe47hKQ4gwTG3o83SeMgzVUhTLw3C62zijd1DSSYec=; b=mEBhT1kkduEmCTsolkVHM1FXoeeTs7/tCnJfH2M+r7fxfHZswj4B3Jit/T4FyOj8Ih 3nuqMl6+/37tlRG5rN/tXShNnghTZbXJnFfB14qCCEff7mh+t+9kkZBSubCenoBFQ9HD jx9FnBcQitYjLYiIZFr7qm2Sb0Niqcwy5aKufe8v9ZRUhOibD4QB5ShKBhJurkhkfV0B rI0x+PbDVheEylBkGlc6RAFRRJ+h55oTboBBrjCIfGlPRSJ++g8TukrziAsqlQJ7PCK0 BQQDyiLYwGq+RegyVefNLzr7/roGxiA3nC+VlUB1yHmQKz15lY/bbjoCMc0aYBFHtVne 5r5w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x13si8725212pgh.116.2019.07.05.04.28.16; Fri, 05 Jul 2019 04:28:31 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728563AbfGEKmY (ORCPT + 99 others); Fri, 5 Jul 2019 06:42:24 -0400 Received: from mga14.intel.com ([192.55.52.115]:63154 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbfGEKmY (ORCPT ); Fri, 5 Jul 2019 06:42:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 03:42:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,454,1557212400"; d="scan'208";a="158476114" Received: from jsakkine-mobl1.tm.intel.com ([10.237.50.189]) by orsmga008.jf.intel.com with ESMTP; 05 Jul 2019 03:42:19 -0700 Message-ID: Subject: Re: [PATCH] tpm: fixes uninitialized allocated banks for IBM vtpm driver From: Jarkko Sakkinen To: Nayna Jain , linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michal Suchanek Cc: linux-kernel@vger.kernel.org, Peter Huewe , Jason Gunthorpe , Michael Ellerman , Michal Suchanek , Mimi Zohar , Sachin Sant , George Wilson Date: Fri, 05 Jul 2019 13:42:18 +0300 In-Reply-To: <1562211121-2188-1-git-send-email-nayna@linux.ibm.com> References: <1562211121-2188-1-git-send-email-nayna@linux.ibm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-07-03 at 23:32 -0400, Nayna Jain wrote: > The nr_allocated_banks and allocated banks are initialized as part of > tpm_chip_register. Currently, this is done as part of auto startup > function. However, some drivers, like the ibm vtpm driver, do not run > auto startup during initialization. This results in uninitialized memory > issue and causes a kernel panic during boot. > > This patch moves the pcr allocation outside the auto startup function > into tpm_chip_register. This ensures that allocated banks are initialized > in any case. > > Fixes: 879b589210a9 ("tpm: retrieve digest size of unknown algorithms with > PCR read") > Signed-off-by: Nayna Jain Please add Reported-by: Michal Suchanek It is missing. Michal is there a chance you could try this out once Nayna send a new version? > --- > drivers/char/tpm/tpm-chip.c | 37 +++++++++++++++++++++++++++++++++++++ > drivers/char/tpm/tpm.h | 1 + > drivers/char/tpm/tpm1-cmd.c | 12 ------------ > drivers/char/tpm/tpm2-cmd.c | 6 +----- > 4 files changed, 39 insertions(+), 17 deletions(-) > > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index 8804c9e916fd..958508bb8379 100644 > --- a/drivers/char/tpm/tpm-chip.c > +++ b/drivers/char/tpm/tpm-chip.c > @@ -550,6 +550,39 @@ static int tpm_add_hwrng(struct tpm_chip *chip) > return hwrng_register(&chip->hwrng); > } > > +/* > + * tpm_pcr_allocation() - initializes the chip allocated banks for PCRs > + */ > +static int tpm_pcr_allocation(struct tpm_chip *chip) Why that name and not tpm_get_pcr_allocation()? Do not get why "get_" has been dropped. Please add it back. Would be senseful to create tpm1_get_pcr_allocation() to tpm1-cmd.c now that a new function needs to be introduced anyway. Please do it for that for TPM 1.x part. /Jarkko