Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp171683imd; Wed, 31 Oct 2018 16:45:47 -0700 (PDT) X-Google-Smtp-Source: AJdET5f6rY6ZfWNZT62zc0IT4kvCdxCVk7ioq9vuz67t1F9YilPjgA2djeto/a6Pu0PIy2JWOqFf X-Received: by 2002:a17:902:8689:: with SMTP id g9-v6mr5158756plo.44.1541029547254; Wed, 31 Oct 2018 16:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029547; cv=none; d=google.com; s=arc-20160816; b=XWp6Qz/qf/F1hrrOccHNwOhpLB4aC1A1KosAxC9wp8Ybxd7BfNZirbkx5fEGrnet21 vwFf++roQeAekXro/bsu/EUDsb/3YpwNufja8JP+z3x0OPXFzchvVmd7SINDu8YluXjA dHNli5Z76vIRLxdvkdmLKs8L+Md9IiUtUMBxE+7Mnw+u9Uo/dXSi9apjXfnBTE+98OZL kq9rPypS3UF1jxGpKSfIcDaugftQfp++mVQuKIUNEXRoJnIincUQN3Yts3WCe3vnkVuv P7Jiwk0URim3iJSQK36S0PxbnYt7klTXPKk4AV3AhG+dVtq60p+IS/Y9cq7+Hf/LgfFI jAqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ra5JxmLP7SsXpJ1l6y4E8W6WOlhDxl9V3w83iQmVAlo=; b=vmkXEnCC+kYAF9kMU5scB2ADBFPpIEm1CwPuDafodkQu2epz7SRKsGJWAJYRrruZrs y/26ymf66YYBLSZyg6zg6F7G0D1QRG5LSSA61Y2ZjypaZ0FdkTraatwFAsCcatd+h1mO xyBu8WzdgqziotxEZQ7qC3zAYZhK4x77Pnc8ld66WSmNMY5U+PbOfLCEyTv0BxhkQaPe nuMzL0cEmueoIeqPfLJBegMMPqRWT4EXDKcUMyICIL+mlI5REE4K9gLPmFrkCVfOfdDx 4xL+bD4Q8XwcPJUVMnc5A1wlGNI9gD0R4Kj4adXIfFEhmW8PZxJO9WVHfeeBqFPQAaiH hYeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=irU08JVT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si13096790ply.423.2018.10.31.16.45.32; Wed, 31 Oct 2018 16:45:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=irU08JVT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729273AbeKAIpc (ORCPT + 99 others); Thu, 1 Nov 2018 04:45:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:55286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728911AbeKAIH2 (ORCPT ); Thu, 1 Nov 2018 04:07:28 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 772E420840; Wed, 31 Oct 2018 23:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027238; bh=vLWUbHyJ1F9RWie9r/Ruut5xtzJHPnSmcxzedt9hT84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irU08JVTr3L2z2rAcG0Nhabm/i/5Vr9Si+C1rj8iwseQ5qyCdcA/9W+7YSbd05yVC G0FSZ5/o+/ZL2K2EvusniCLRPsITN07qJVhkiwC+n/+TpVzmknrES7ifDG75V02Y78 aOwjOHNkaTXmhUxC9slsH1J0Ld0SP/CXg1DjATQk= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , Jarkko Sakkinen , Sasha Levin Subject: [PATCH AUTOSEL 4.19 106/146] tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated Date: Wed, 31 Oct 2018 19:05:01 -0400 Message-Id: <20181031230541.28822-106-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 1a803b0cf980..9f61106502a9 100644 --- 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 *chip, struct tpm_space *space, 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) -- 2.17.1