Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3435638imu; Sun, 11 Nov 2018 15:03:27 -0800 (PST) X-Google-Smtp-Source: AJdET5djC/hj6uZd6G+CPPeT/cgLTk7fg0zNrO1h4Hj5E7zCbLw+W2hs+m21tXIzCHz7+LOwE/nl X-Received: by 2002:a62:1a92:: with SMTP id a140-v6mr17790226pfa.219.1541977407211; Sun, 11 Nov 2018 15:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977407; cv=none; d=google.com; s=arc-20160816; b=t/FwYEOUtrM0o40SfnCHHFTktO9FrmlF1x6XDy2dfG0vB5vu1fv/zoSAhlpMiipvJX ycP+jlIq7xsm6a3g4+ENvtx5llb8vwg/vPvM1DnU7v4thIGOXett8tWO5M0U3DCGg6oM AuAE3ga457XibaPLuWDq3nvTLW038ViSb7fuDEdl+kSqLrWWsEtJqKa8Xl0LW0H2v9Zb b6ROt1p8Ro94vV9tqfhpNi99zggSZcgSwq6ML2oxUoduQTw7W2/Z+/55CJnXDtaHgoDq R6oBXJUhu4A0Md0C4JjBUNlSbvGnyT9YzDFmZ+16PHx2grXR3n8z1reUUrPwB7Jw9Vf9 OAqA== 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=ailggnJC6iiXbGMAtvG+IeE1pQgM0JSmsBxX45AQfGg=; b=H3y6pUiKoWQ0AqmaFqDdDIPEP+xplpRfro7U+31qurQxV7caN+cJ6y8vWPkWz+sDwH 3mXbh12ER0kuGcRktHVXg8sAlWZ3TemmHyLe8uLl+RM2ZyR+jw5TK83EUA+xPGuMtDym X9y62vIkn0LnhSfywXUd5BGR/a5oEoy1s5JyKgJKHNVXBIrAFienAP3HEkHzgQY9sMYc nglF5wgKAFKUyA8THjBIvJ3TJ65bItONNGm9i32f1Mgw636u5eT87JHmv75Q5DzZmh6M dFNLughxFBAjq/os+RuZQCdrtf85XPE5rOPl+0+RwcW9NTsvq9GMNxXe/bM69K4F+9Kh 7Sqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L5Ox4l3T; 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 15-v6si16645905pfr.242.2018.11.11.15.03.12; Sun, 11 Nov 2018 15:03:27 -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=L5Ox4l3T; 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 S2390728AbeKLIw7 (ORCPT + 99 others); Mon, 12 Nov 2018 03:52:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:52416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390547AbeKLIW0 (ORCPT ); Mon, 12 Nov 2018 03:22:26 -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 17A8F224E3; Sun, 11 Nov 2018 22:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975549; bh=sh8S/lQ+MrXUHkEDCQXcxVvrb2zPzeTjWV+g1IC7IrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5Ox4l3T/jJBI7xFSNGlg7CXjFBmK4xdC9W5Z3aqhhczyRw7UGPDBnf9lkYE0tkvI yAcMw/FksrzlUIlDxTdRmcppTn9Dalqht3LSMRfy6ddL0ioZoCD1+782ngNbz57HX7 mlZVwzTOeyFAF5kQ04BRY3ieQ8PWUkYE6R2PvzfA= 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.14 086/222] tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated Date: Sun, 11 Nov 2018 14:23:03 -0800 Message-Id: <20181111221655.712279230@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -653,7 +653,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)