Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966507AbcJFIzx (ORCPT ); Thu, 6 Oct 2016 04:55:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48877 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965975AbcJFIzr (ORCPT ); Thu, 6 Oct 2016 04:55:47 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Pronin , Jason Gunthorpe , Jarkko Sakkinen Subject: [PATCH 4.4 38/93] tpm: fix byte-order for the value read by tpm2_get_tpm_pt Date: Thu, 6 Oct 2016 10:29:08 +0200 Message-Id: <20161006074732.732496547@linuxfoundation.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006074731.150212126@linuxfoundation.org> References: <20161006074731.150212126@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1199 Lines: 36 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: apronin@chromium.org commit 1b0612b04090e416828c0dd5ed197b0913d834a0 upstream. The result must be converted from BE byte order, which is used by the TPM2 protocol. This has not popped out because tpm2_get_tpm_pt() has been only used for probing. Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support") Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 Signed-off-by: Andrey Pronin Reviewed-by: Jason Gunthorpe Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm2-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -657,7 +657,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); if (!rc) - *value = cmd.params.get_tpm_pt_out.value; + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); return rc; }