From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [PATCH] tpm: fix buffer overflow in /dev/tpm0 Date: Sun, 11 Sep 2016 22:05:46 -0600 Message-ID: <20160912040546.GA14625@obsidianresearch.com> References: <1473596340-11376-1-git-send-email-jarkko.sakkinen@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1473596340-11376-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jarkko Sakkinen Cc: "moderated list:TPM DEVICE DRIVER" , open list List-Id: tpmdd-devel@lists.sourceforge.net 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. Jason ------------------------------------------------------------------------------