From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751799AbdAPNZT (ORCPT ); Mon, 16 Jan 2017 08:25:19 -0500 Received: from mga01.intel.com ([192.55.52.88]:40679 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbdAPNZR (ORCPT ); Mon, 16 Jan 2017 08:25:17 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,239,1477983600"; d="scan'208";a="31151571" Date: Mon, 16 Jan 2017 15:25:12 +0200 From: Jarkko Sakkinen To: Stefan Berger Cc: tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5] tpm: Check size of response before accessing data Message-ID: <20170116132512.zyzt4gflticb6xz2@intel.com> References: <1484361394-13581-1-git-send-email-stefanb@linux.vnet.ibm.com> <20170116132409.i2y7ipchsohqfqxz@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170116132409.i2y7ipchsohqfqxz@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 16, 2017 at 03:24:09PM +0200, Jarkko Sakkinen wrote: > On Fri, Jan 13, 2017 at 09:36:34PM -0500, Stefan Berger wrote: > > Make sure that we have not received less bytes than what is indicated > > in the header of the TPM response. Also, check the number of bytes in > > the response before accessing its data. > > > > Signed-off-by: Stefan Berger > > There are some things that I want to comment after all but I can give > now > > Tested-by: Jarkko Sakkinen > > I also noticed that this patch is not CC'd to linux-kernel. Please go through the whole patch and remove arithmetic from every possible place where you only end up with a constant. /Jarkko