Received: by 10.213.65.68 with SMTP id h4csp2542748imn; Mon, 2 Apr 2018 09:23:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx48fcbTPGUmW0wp7Z6bjssfxkhluYyQoyDBFwb9+XWJzHAeWLfP0rhBtsYzajrxWgOzy01Jn X-Received: by 10.98.157.157 with SMTP id a29mr7802980pfk.39.1522686217433; Mon, 02 Apr 2018 09:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522686217; cv=none; d=google.com; s=arc-20160816; b=TGamkV4mKce3DuwpKCw5LZtOjPUxfKD+recP/r85JdEjK7nIBJI2AJdcv6NSZdAXQf eD0+cZdsTtFToocOdDikNQcyNtaROo3/0epSTOofHNfOqmTYjzUOzoAmDBIV1d3A6Maz 51jW0J+cT6CMfL6O+k6rlT65x3Lh5SpJ86XJxVhInqmtHQSmaTPDo5g4kkc1ji/Wx+T+ uqtcMgNtzPw88syX5d4suhKVbYxWwHZj5Pep2RDbMmsSBLyaZAzCvvm1qmVVBYtjCKlU gPNcxakImIF81CKDbxvaGRfDiafXglV8qYY8QtyFjXsCwTJyBhwJn77ccBzdrHzZ6jwK Emyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rgOS5bo+f6/KEglcInPluZDef+OL57hB6Pz7XT/hcIY=; b=pWjWf3gRK8JY3kpkQ11sUlYRg+OJBv/zNFONNJqQdJafCoqkuSh6x6cWScDDElrMFx v+HSChPSwMr3wCXMGhRr/7/OK1PU/96PUsnJxBfA29xUfO0quCeKRqfl1/L87jY+bKe+ ckXY2hOovRfs2vCQWHieaOphsjVpP/gduuYLysiwIfsnwa8uJrl2UMPxy/BZvTVryLx5 TfpASogGGas3bm8g1iDJcujgW13TUD53IWBm4iIQ+fXezU5L5m9fyMBK+RIDAA6R+RZW w5XLkPokYroU3a7jFEadD77oGz8Cz2kt4pFLF85rxI1cxy6bfNLPMYEgczFa1zBdxo4M sGMg== 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 o1-v6si591029plb.459.2018.04.02.09.23.22; Mon, 02 Apr 2018 09:23:37 -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 S1752973AbeDBQVz (ORCPT + 99 others); Mon, 2 Apr 2018 12:21:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35086 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752771AbeDBQVx (ORCPT ); Mon, 2 Apr 2018 12:21:53 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w32GLd8Z008670 for ; Mon, 2 Apr 2018 12:21:52 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h3p9jw2ek-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 02 Apr 2018 12:21:52 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 2 Apr 2018 17:21:50 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 2 Apr 2018 17:21:46 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w32GLjYk28573836; Mon, 2 Apr 2018 16:21:45 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5D7F4C044; Mon, 2 Apr 2018 17:14:37 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF0E34C04A; Mon, 2 Apr 2018 17:14:34 +0100 (BST) Received: from swastik.in.ibm.com (unknown [9.77.204.10]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 2 Apr 2018 17:14:34 +0100 (BST) From: Nayna Jain To: linux-integrity@vger.kernel.org Cc: zohar@linux.vnet.ibm.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, jarkko.sakkinen@linux.intel.com, tpmdd@selhorst.net, jgunthorpe@obsidianresearch.com, Nayna Jain Subject: [PATCH] tpm: moves the delay_msec increment after sleep in tpm_transmit() Date: Mon, 2 Apr 2018 21:50:06 +0530 X-Mailer: git-send-email 2.13.6 X-TM-AS-GCONF: 00 x-cbid: 18040216-0012-0000-0000-000005C61E58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040216-0013-0000-0000-000019422823 Message-Id: <20180402162006.5030-1-nayna@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-02_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804020182 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit e2fb992d82c6 ("tpm: add retry logic") introduced a new loop to handle the TPM2_RC_RETRY error. The loop retries the command after sleeping for the specified time, which is incremented exponentially in every iteration. This patch fixes the initial sleep to be the default sleep time. Fixes: commit e2fb992d82c6 ("tpm: add retry logic") Signed-off-by: Nayna Jain Reviewed-by: Mimi Zohar --- drivers/char/tpm/tpm-interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index c43a9e28995e..6201aab374e6 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -587,7 +587,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, */ if (rc == TPM2_RC_TESTING && cc == TPM2_CC_SELF_TEST) break; - delay_msec *= 2; + if (delay_msec > TPM2_DURATION_LONG) { if (rc == TPM2_RC_RETRY) dev_err(&chip->dev, "in retry loop\n"); @@ -597,6 +597,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, break; } tpm_msleep(delay_msec); + delay_msec *= 2; memcpy(buf, save, save_size); } return ret; -- 2.13.6