Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2983798imu; Mon, 19 Nov 2018 08:59:23 -0800 (PST) X-Google-Smtp-Source: AJdET5c625cTdb1sIP9Afox3hsa/wyIDBDhRdNjGWmn31wd8QmgzkmmZm8eCMNNsi5cz8A/cM/TZ X-Received: by 2002:a17:902:b282:: with SMTP id u2mr23433974plr.89.1542646763273; Mon, 19 Nov 2018 08:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646763; cv=none; d=google.com; s=arc-20160816; b=DFYxQ2EagI/VUMrMYPPrfKihrC9OyREOeFr4JfsLxMmd9PlzL8uFgnC+NmSkMYkJ6N IG2UtAnEnsoC10QrOnFA49im37Bp5Iz+mdRgHEC1HpJk5FheXs3ndj4Fokim+4F5KqOu bhWzg8m+CqAy+BIUE20IEqK5PMBe1zVJDc4i+gQriN5qlqkePsyLK2XbT/Nmc07i984J a5nNPbwwCD6hp0F20RwfF5EmLrfTVZcg06Vsg7QjMTHrg9MTx1ascqEcHXJUL3JMKyDd 3xDNVFzfxjhNeGHh9cRqY/6/3VhxL1Zfua8K0IdP9rHTpXdtBiM4QtOPKdG291+v7zkd CrLw== 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=LDxJ/QapF1bFx4QtaLnguB8liTISwsqRLkD/Le5lVT8=; b=HDdTr4IHvc4TdB81Xp4LUNUUfjmzTbj094RBy5zOLhjjaWffYcGlQwEB4T1s3BxJiS iVR2H4eVnYDY34FftXULFE+2FMRx5D0a2UNi5j09w8jCThxCf7qupSyR5tyrkzSYMpLB wRs6kvqk9nMNNqH63Elp4z05Rwd5LD6yhOiXijgdm6VfSjLB8livLzvB2eNrdky51Hl7 l1jnsn4LlQorBo8ddhO1l9p8/RlcO0P6INzjjcD33ws5xWF/Cnx6HdaJwQWa4JdKVOFm M5VvpBHNrS4p7fgN6BMq+XktROnkxbfsrD2g/pcUFI/5VfV0y8537LnJ2NK42M3ZoUAk 9RgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jo9UB6Wj; 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 c1-v6si42127370pld.11.2018.11.19.08.59.08; Mon, 19 Nov 2018 08:59:23 -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=Jo9UB6Wj; 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 S2404511AbeKTDVf (ORCPT + 99 others); Mon, 19 Nov 2018 22:21:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:33014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404158AbeKTDVe (ORCPT ); Mon, 19 Nov 2018 22:21:34 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 7F7DC206BA; Mon, 19 Nov 2018 16:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646639; bh=y9u+PBWpanrmry/0/xGm5lC1G6mNWjUnjFJWayjBTDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jo9UB6WjkDb5HlHLJP1dqaxgGRCOWVxqgxnpubk4GtF9vV8ZD0Fn6ha4+FzM82YSy 0J+ZLjt2/ZR60T3nUHff/1JTxqu/BPn1qQqaI0luU5kgLwi06i9O7YACrvBy6xbHFE edGMCE2e/wYE1wqv7s985Q0hJwE3sqI8rDfy8Eug= 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.4 034/160] tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated Date: Mon, 19 Nov 2018 17:27:53 +0100 Message-Id: <20181119162634.248839079@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162630.031306128@linuxfoundation.org> References: <20181119162630.031306128@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.4-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 @@ -415,7 +415,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip header = cmd; 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);