Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3636312ybi; Fri, 5 Jul 2019 10:54:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTGxmQchsM4Xqv5Crw05EvbGJUZhwpnv2DUZUcvph5t5sHu7ULB9NrwM/ZwahIXsLSQ2sZ X-Received: by 2002:a63:f14:: with SMTP id e20mr6842231pgl.227.1562349284368; Fri, 05 Jul 2019 10:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562349284; cv=none; d=google.com; s=arc-20160816; b=nCbiM9LBfy4QbhHKZNHVnvwigZUdofimR3pvL+THyONUTwMuDfLqrVFIl9mGq2Eo6W feH/j5YtY5c74haVbIG/3ggd+BDONJwQFsCV9JnJtAYvvB0rih2U8Oh0kM4rn7+w0iR+ q5Pd6QEy4RmvlvIVkTfdX3cT8pDQZfEyGkznboZWQVR2sd+1iMCaQgu3hzM/p+veGfPW AV6H6utfLrfumXlSZUWl90/9dx5FjBNiSI33af5lleeDiKDvh1wwBnt/fM9W1aDbbBAt wt3aWfj7DmYVSZOQtBj87j6L+oPGJO+KKmdh2S4am0JFF/dkr8tGFGlsw7KHNmmOpO8K fSSA== 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=YuS2VewrV58mizY2sLoEvEOHHlG491Tc6UJVEsD36lc=; b=Xvw1UI0DN467bYPGLiGy0kPlSdgaC4LDKhXATR14DLvpwcRpQk8XJ7zkzPNrcV37vh 2DIW9YDapG9wcvdbM/HK9mZud5zNy6U6K3Q6of324Kakq8w2zUFfaxZLsiQ2vEZbYUED zuewQ6sHNOxGEPh99qkXOHnEDjjDwU+a+RIe6KjnPpPxc7O23Vnh5glAjCR2G9Hzs4af n+fEWjGX33DJbM0mgjqG2OscRaGxC9dENeSOrpElMO7w0jSnMYs0a3O2OS3xRxjXEsj3 e6S2T4KOl/jUrOT7krsaWp3jjavmwv9lk1OX3qAEydJvjr6WuGdVoyicabThrjDu3DRc ACeg== 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 gb4si9161585plb.429.2019.07.05.10.54.29; Fri, 05 Jul 2019 10:54:44 -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 S1726559AbfGERuf (ORCPT + 99 others); Fri, 5 Jul 2019 13:50:35 -0400 Received: from mga12.intel.com ([192.55.52.136]:8637 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfGERuf (ORCPT ); Fri, 5 Jul 2019 13:50:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 10:50:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,455,1557212400"; d="scan'208";a="175559214" Received: from hsolima-mobl1.ger.corp.intel.com ([10.252.48.252]) by orsmga002.jf.intel.com with ESMTP; 05 Jul 2019 10:50:28 -0700 Message-ID: <1270cd6ab2ceae1ad01e4b83b75fc4c6fc70027d.camel@linux.intel.com> Subject: Re: [PATCH] tpm: fixes uninitialized allocated banks for IBM vtpm driver From: Jarkko Sakkinen To: Nayna , Stefan Berger , Nayna Jain , linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: Sachin Sant , Michal Suchanek , linux-kernel@vger.kernel.org, Mimi Zohar , Jason Gunthorpe , Peter Huewe , George Wilson Date: Fri, 05 Jul 2019 20:50:27 +0300 In-Reply-To: <164b9c6e-9b6d-324d-9df8-d2f7d1ac8cfc@linux.vnet.ibm.com> References: <1562211121-2188-1-git-send-email-nayna@linux.ibm.com> <1998ebcf-1521-778f-2c80-55ad2c855023@linux.ibm.com> <164b9c6e-9b6d-324d-9df8-d2f7d1ac8cfc@linux.vnet.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 Fri, 2019-07-05 at 11:32 -0400, Nayna wrote: > I am not sure of the purpose of tpm_stop_chip(), so I have left it as it > is. Jarkko, what do you think about the change ? Stefan right. Your does not work, or will randomly work or not work depending on the chip. You need to turn the TPM on with tpm_chip_start() and turn it off with tpm_chip_stop() once you are done. This is done in tpm_chip_register() before calling tpm_auto_startup(). TPM power management was once in tpm_transmit() but not anymore after my patch set that removed nested tpm_transmit() calls. While you're on it please take into account my earlier feedback. Also, short summary could be "tpm: tpm_ibm_vtpm: Fix unallocated banks" Some oddballs in your patch that I have to ask. if (chip->flags & TPM_CHIP_FLAG_TPM2) { rc = tpm2_get_pcr_allocation(chip); if (rc) goto out; } chip->allocated_banks = kcalloc(1, sizeof(*chip->allocated_banks), GFP_KERNEL); if (!chip->allocated_banks) { rc = -ENOMEM; goto out; } Why you don't return on site and instead jump somewhere? Also the 2nd line for kcalloc() is misaligned. out: if (rc < 0) rc = -ENODEV; This will cause a new regression i.e. you let TPM error codes through. To summarize this patch fixes one regression and introduces two completely new ones... /Jarkko`