mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	"moderated list:TPM DEVICE DRIVER" 
	<tpmdd-devel@lists.sourceforge.net>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tpm: fix buffer overflow in /dev/tpm0
Date: Mon, 12 Sep 2016 10:50:57 +0300	[thread overview]
Message-ID: <20160912075057.GA5094@intel.com> (raw)
In-Reply-To: <20160912040546.GA14625@obsidianresearch.com>

On Sun, Sep 11, 2016 at 10:05:46PM -0600, Jason Gunthorpe wrote:
> On Sun, Sep 11, 2016 at 03:19:00PM +0300, Jarkko Sakkinen wrote:
> > tpm_write() does not check whether the buffer has at least enough space
> > for the header before passing it to tpm_transmit() so an overflow can
> > happen.
> 
> Eh?
> 
> tpm_write uses a hard wired buffer size of TPM_BUFSIZE when working
> with tpm_transmit.
> 
> in_size is never used except for the copy. We should probably fix that
> to sanity check the header length vs in_size.
> 
> That doesn't seem to be a security issue however because the header
> length is propery limited to TPM_BUFSIZE and the data buffer is
> allocated specifically for that process using kzalloc.

I was working on something else when I bumped into this. The commit
message is not the best possible but still the issue is valid although
it does not cause any imaginable harm because there is always
TPM_BUFSIZE of room in the buffer passed by tpm_write.

I'll update the commit message not to speak about tpm_write.

"tpm_transmit() does not check whether the bufsiz can contain the TPM
header. Add check for this and return -EINVAL if it the buffer is too
small."

The check should be in tpm_transmit() and also the commit message should
be only about that.

> Jason

/Jarkko

      reply	other threads:[~2016-09-12  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-11 12:19 Jarkko Sakkinen
2016-09-11 12:51 ` Jarkko Sakkinen
2016-09-11 18:57   ` Jarkko Sakkinen
2016-09-12  4:05 ` Jason Gunthorpe
2016-09-12  7:50   ` Jarkko Sakkinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160912075057.GA5094@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome