From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751253AbdAPPiz (ORCPT ); Mon, 16 Jan 2017 10:38:55 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44351 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750831AbdAPPix (ORCPT ); Mon, 16 Jan 2017 10:38:53 -0500 Subject: Re: [PATCH v5] tpm: Check size of response before accessing data To: Jarkko Sakkinen References: <1484361394-13581-1-git-send-email-stefanb@linux.vnet.ibm.com> <20170116132409.i2y7ipchsohqfqxz@intel.com> <20170116132512.zyzt4gflticb6xz2@intel.com> Cc: tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org From: Stefan Berger Date: Mon, 16 Jan 2017 10:38:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20170116132512.zyzt4gflticb6xz2@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17011615-0020-0000-0000-00000B164793 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006444; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000199; SDB=6.00808416; UDB=6.00393711; IPR=6.00585775; BA=6.00005060; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013936; XFM=3.00000011; UTC=2017-01-16 15:38:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17011615-0021-0000-0000-0000593F5DC7 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-16_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701160231 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/16/2017 08:25 AM, Jarkko Sakkinen wrote: > 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. sizeof(cap.timeout) -- what do you want to do about that? Is that legitimate or do you want a number then??? What about offsetof's?