Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4935485ybi; Sat, 6 Jul 2019 17:27:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaXAxD3FhtCdLavkcP9mctFv6xPkHGCKLEMN6YGf/YFu4HPWayW9YsmGdWjjns2CvmC5a/ X-Received: by 2002:a17:902:467:: with SMTP id 94mr13873921ple.131.1562459265122; Sat, 06 Jul 2019 17:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562459265; cv=none; d=google.com; s=arc-20160816; b=KrNxyh0+AYFYayNgXxx3b6hKLD4SIY6wlKVoAg598XNSg06bn7OWPop3YGCb2FX3wh Hra1YnqRgM63p6YEFTWs9CwrZRpPSOcZEWlg1uugjcnLg83mgXifDGSvj88Ccb8WR1cV ysKAf01kkYFoLwai4+Pg9GOSoMDmG9Mdgd3MMvxbrmzVHrxr1AC5jSRF+QSBSalSB/mX UtnfRE6sRPetJK0dK0pB4bKl7DQQ239TA24nc431F/OJHMchNKXRiQxHyYLAOhY0RFue Nc0eAq71eFtcDx9OYZfL5MskAzb41L3T2MS8vrzDg9MVcCLzGK+E2PKICYPpPwQnNu9C sydA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject; bh=MksYa8kZS0sfrF0XmsiLER+64UOSjMxO5Hq5UNEgZOs=; b=MvfDiy8iTg0dQH7MvxlKQ/8em44Oj6kWupJd1S12aqbBzv+TPZGxylva29DqdIEc4x rR3oTrj417yWksdUC6FGoNJttAnEFFWjPhrS1JUa8qcM8bkFx8cYH9HzhqfrDL6WxD/1 hgAs4Mp9Erk0DFZIMGWUOXx+wHqgKuG+n5sGgSvGO+3J48eH/fuCezWAClCe2e1cybeL E5xyQA1PKy6o3xfhDKAMdsN2x9pAHrWgf7/r0Xj5FxvDQDuSnywGSm7hNEvKsy6wXk8d +ESr9lfU1kt0gVgNKzsiBMAjIX8NqmSjjYzXJyjfqIr7c86QzW8OMnIhOZ6l7f824Ojy sHcQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si13447565plb.420.2019.07.06.17.27.28; Sat, 06 Jul 2019 17:27:45 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727015AbfGGAZu (ORCPT + 99 others); Sat, 6 Jul 2019 20:25:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58432 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726859AbfGGAZt (ORCPT ); Sat, 6 Jul 2019 20:25:49 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x670LMlC050547 for ; Sat, 6 Jul 2019 20:25:48 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tjt04gxp6-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 06 Jul 2019 20:25:48 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 7 Jul 2019 01:25:47 +0100 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 7 Jul 2019 01:25:43 +0100 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x670Pglg61866240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 7 Jul 2019 00:25:42 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40D20BE054; Sun, 7 Jul 2019 00:25:42 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 14528BE051; Sun, 7 Jul 2019 00:25:39 +0000 (GMT) Received: from swastik.ibm.com (unknown [9.80.232.154]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Sun, 7 Jul 2019 00:25:39 +0000 (GMT) Subject: Re: [PATCH] tpm: fixes uninitialized allocated banks for IBM vtpm driver To: Jarkko Sakkinen , Stefan Berger , Nayna Jain , linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: Sachin Sant , George Wilson , linux-kernel@vger.kernel.org, Mimi Zohar , Jason Gunthorpe , Peter Huewe , Michal Suchanek 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> <1270cd6ab2ceae1ad01e4b83b75fc4c6fc70027d.camel@linux.intel.com> From: Nayna Date: Sat, 6 Jul 2019 20:25:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1270cd6ab2ceae1ad01e4b83b75fc4c6fc70027d.camel@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 19070700-0036-0000-0000-00000AD46E87 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011389; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01228488; UDB=6.00646913; IPR=6.01009737; MB=3.00027615; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-07 00:25:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19070700-0037-0000-0000-00004C7EBA69 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-06_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=969 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907070004 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/05/2019 01:50 PM, Jarkko Sakkinen wrote: > 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... Thanks Jarkko. I just now posted the v2 version that includes your and Stefan's feedbacks. Thanks & Regards,        - Nayna