Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443908

Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Andrey Pronin <apronin@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt
Date Fri, 15 Jul 2016 05:20:01 +0200
Message-ID <rV1Pr-1AM-1@gated-at.bofh.it> (permalink)
References <rUZND-h3-3@gated-at.bofh.it> <rUZND-h3-1@gated-at.bofh.it> <rV1Pr-1AM-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KgcBx/UWqtNOkJe4G3FtpHJ3xoiLuTJzmMjbPTOPbLE=; b=XUCkeq8SYX0MR17+5t7MH1cav6lcQT/AfwPSSMov2kLiMSA18FNeMSXxy5xZm/gWxI Pb+1nM7W22Q/2DVmRTnhHl1bCTn7gkDS9en1+4fbJlOPASoLQ2gkdivHCuJR8yMQU1In 5QA/e4z1vhfA7Dt2hfxFVxmkF93XGVao97eC0=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KgcBx/UWqtNOkJe4G3FtpHJ3xoiLuTJzmMjbPTOPbLE=; b=iN6fbwm22aT98WRh6A1UyiebyIvUfcicF9ZnozxRuU65AVHsJAhzO/UJv8YKLmpMzA hckaOK901SUpJf1cjo3fechWQ0bUpjQpg6OyPMprwR0LhRq82sTz+u1xf8LVlXzqt99+ GJw8jyfN7WBB6JntnreN7+PeDxsTCIe/VUs2SMREIbMsJ3+glGZYfos5SIz9/T+RvtFQ LnwcSqwLK0ReVYsU26dGWXyf1aySQd1XD4G+rA+o0mWxEy5iLu4vYs1SWh7AWIwkHQnJ P75WNveiQcx5XEyRQ12l9IZStvlVy48RwQnHra7XoRLkm1qh2IU+FvH4vEwUb1wEXPuI GFTA==
X-Gm-Message-State ALyK8tIdZHRYKz5mCcxiTSkat7T8QfeNs52Yr1bD45BxUioWTv/TbVIIjlFtsfMwyp3bPCTZ
X-Received by 10.98.85.5 with SMTP id j5mr17680535pfb.81.1468552624111; Thu, 14 Jul 2016 20:17:04 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 34
Organization linux.* mail to news gateway
X-Original-Cc Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>, Peter Huewe <peterhuewe@gmx.de>, Marcel Selhorst <tpmdd@selhorst.net>, tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, groeck@chromium.org, smbarber@chromium.org, dianders@chromium.org
X-Original-Date Thu, 14 Jul 2016 20:17:01 -0700
X-Original-Message-ID <20160715031701.GA25406@apronin>
X-Original-References <1468544838-9990-1-git-send-email-apronin@chromium.org> <1468544838-9990-3-git-send-email-apronin@chromium.org> <20160715031046.GC9347@obsidianresearch.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1443908

Show key headers only | View raw


On Thu, Jul 14, 2016 at 09:10:46PM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote:
> > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590
> > Signed-off-by: Andrey Pronin <apronin@chromium.org>
> >  drivers/char/tpm/tpm2-cmd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> > index a1673dc..a88b31e 100644
> > +++ b/drivers/char/tpm/tpm2-cmd.c
> > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id,  u32 *value,
> >  
> >  	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);
> 
> Huh.
> 
> Jarkko: Are you running sparse on the tpm stuff? The annotations look
> right here, sparse should have complained on this? Andrey, did sparse
> complain here or is there something more serious wrong as well??
> 
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Jason

No, this is not sparse complaining. I tried using tpm2_get_tpm_pt() to
read permanent flags and discovered that it was missing byte-ordering
conversion. The only place tpm2_get_tpm_pt() was used before was in
tpm2_gen_interrupt, which discarded the result. So, nobody noticed,
I guess.

Andrey

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt Andrey Pronin <apronin@chromium.org> - 2016-07-15 03:10 +0200
  Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Andrey Pronin <apronin@chromium.org> - 2016-07-15 05:20 +0200
    Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-15 05:40 +0200
      Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-15 21:40 +0200
        Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 21:10 +0200
      Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Andrey Pronin <apronin@chromium.org> - 2016-07-15 21:40 +0200
  Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-15 05:20 +0200
  Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 21:10 +0200
  Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 21:10 +0200
    Re: [PATCH 2/2] tpm: fix byte-order for the value read by  tpm2_get_tpm_pt Andrey Pronin <apronin@chromium.org> - 2016-07-18 21:20 +0200

csiph-web