Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3482897imu; Sun, 11 Nov 2018 16:07:18 -0800 (PST) X-Google-Smtp-Source: AJdET5c/ira2uTgiIJSWuUyNg0PGQeFyndgXaVfx7ItMfH1ybMjQiu/WesNN0HsLB5HmkIBrmIc8 X-Received: by 2002:a17:902:8689:: with SMTP id g9-v6mr17581805plo.44.1541981238619; Sun, 11 Nov 2018 16:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981238; cv=none; d=google.com; s=arc-20160816; b=ZllV+JAwaNiX+jmYeLMntC6vuwhy5JvEaQCiJdjSOma4lhxf0opuFLRfa8pdiVKEii expBICZhBOISRlEVAZotz6jYk7Dkpmxqaiz9OB+XK0s9A5jPam5r84folctlUURYHAiX YrvlJYJK5ACy2aiKnS5YthHhIQUDrDuS0ksfTGDOD8KTl2o5XfAW6jMCbe+qq7SjDqWN f/DryOG0LBOdPw0knzLxXdaWRNKFZzO2CX0DrFm2PIj6XYfVbwuw2HcGByxhpwbtcvet jqznjsJir+gh5aaqjlvx2Xvury1i2TCYzO6BbmkolBh2knwip0evLBZjjAjbG9h1lPPU iNAA== 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=VGVSuh90XDfg5hhnQHkl/Nh9Whfqa6FqxaPnc2bLvOY=; b=VrwFBHdwAdieFxZaf5Yj7TSyuzGi1BevyHmbBELvpDZqL4La9ry9QbyVFiYVSvjeD7 jTxIsCXBM00FqsCs4RyY25hDqhYq3V3FXcuvP43PdlHhHHv53h8jEkazcuUcik6EqoK7 9wZ03ccNDr8zKmjSgdcOVX/j2VbnVRGn50rJotwHFrxx64a+nniVWjw9Aa/YItv/Q6PQ udGgMrrDVItDEW57YGoD/DE2QMP3BTpJSXJ9ci5kqP9+pkOPEZkcVZBEh9rnPFfNZg5H vuTTlbFB4PPFi0Ed7qvw3Woi+jAJz4LG4r2mljXcm3GGfqKI0DhSW+9/FWKxx1kDLzZb bKWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JZ6QBXm0; 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 az12-v6si15315219plb.166.2018.11.11.16.07.03; Sun, 11 Nov 2018 16:07:18 -0800 (PST) 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=JZ6QBXm0; 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 S1732149AbeKLJ5H (ORCPT + 99 others); Mon, 12 Nov 2018 04:57:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:33814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731776AbeKLIRi (ORCPT ); Mon, 12 Nov 2018 03:17:38 -0500 Received: from localhost (unknown [206.108.79.134]) (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 2C03621731; Sun, 11 Nov 2018 22:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975263; bh=UKfFkHX1ZHMOipsEkEKQX99rH48sGpcRDgcuUfRZ3ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZ6QBXm0D9AIZpXKxK0qIgG6tLEyJ4/s5nIs/IgoPQ8pcCVgn0CwNSGdlsaBdorWO rVg1Z64vOv+Q2TTmNhYissj3VKyawo6KSouaZnxf2wRxbr7nFoIIdhJGj8MN6gQKNl O6VFmiLOFHuY3GMiz01PdMpEnefFjQFtbIydV1Ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Javier Martinez Canillas , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 4.19 151/361] tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated Date: Sun, 11 Nov 2018 14:18:18 -0800 Message-Id: <20181111221641.574157382@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Javier Martinez Canillas [ Upstream commit 0d6d0d62d9505a9816716aa484ebd0b04c795063 ] For TPM 1.2 chips the system setup utility allows to set the TPM device in one of the following states: * Active: Security chip is functional * Inactive: Security chip is visible, but is not functional * Disabled: Security chip is hidden and is not functional When choosing the "Inactive" state, the TPM 1.2 device is enumerated and registered, but sending TPM commands fail with either TPM_DEACTIVATED or TPM_DISABLED depending if the firmware deactivated or disabled the TPM. Since these TPM 1.2 error codes don't have special treatment, inactivating the TPM leads to a very noisy kernel log buffer that shows messages like the following: tpm_tis 00:05: 1.2 TPM (device-id 0x0, rev-id 78) tpm tpm0: A TPM error (6) occurred attempting to read a pcr value tpm tpm0: TPM is disabled/deactivated (0x6) tpm tpm0: A TPM error (6) occurred attempting get random tpm tpm0: A TPM error (6) occurred attempting to read a pcr value ima: No TPM chip found, activating TPM-bypass! (rc=6) tpm tpm0: A TPM error (6) occurred attempting get random tpm tpm0: A TPM error (6) occurred attempting get random tpm tpm0: A TPM error (6) occurred attempting get random tpm tpm0: A TPM error (6) occurred attempting get random Let's just suppress error log messages for the TPM_{DEACTIVATED,DISABLED} return codes, since this is expected when the TPM 1.2 is set to Inactive. In that case the kernel log is cleaner and less confusing for users, i.e: tpm_tis 00:05: 1.2 TPM (device-id 0x0, rev-id 78) tpm tpm0: TPM is disabled/deactivated (0x6) ima: No TPM chip found, activating TPM-bypass! (rc=6) Reported-by: Hans de Goede Signed-off-by: Javier Martinez Canillas Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm-interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -663,7 +663,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip return len; err = be32_to_cpu(header->return_code); - if (err != 0 && desc) + if (err != 0 && err != TPM_ERR_DISABLED && err != TPM_ERR_DEACTIVATED + && desc) dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err, desc); if (err)