From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:42106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hB46D-0002rX-VT for qemu-devel@nongnu.org; Mon, 01 Apr 2019 17:04:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hB46C-0004Pi-O4 for qemu-devel@nongnu.org; Mon, 01 Apr 2019 17:04:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52622 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hB46C-0004Ip-IV for qemu-devel@nongnu.org; Mon, 01 Apr 2019 17:04:08 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x31L3q45062154 for ; Mon, 1 Apr 2019 17:03:57 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rkskgsynd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 01 Apr 2019 17:03:53 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Apr 2019 22:03:07 +0100 From: Michael Roth Date: Mon, 1 Apr 2019 15:59:59 -0500 In-Reply-To: <20190401210011.16009-1-mdroth@linux.vnet.ibm.com> References: <20190401210011.16009-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Message-Id: <20190401210011.16009-86-mdroth@linux.vnet.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 85/97] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Stefan Berger , Stefan Berger From: Stefan Berger Make sure that the new locality passed to tpm_tis_prep_abort() is valid. Add a comment to aborting_locty that it may be any locality, including TPM_TIS_NO_LOCALITY. Signed-off-by: Stefan Berger Reviewed-by: Marc-Andr=C3=A9 Lureau (cherry picked from commit e92b63ea610201bd743343fc6b11e6c39c8d3515) Signed-off-by: Michael Roth --- hw/tpm/tpm_tis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index d9322692ee..9a795ce96c 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t l= octy, uint8_t newlocty) { uint8_t busy_locty; =20 - s->aborting_locty =3D locty; + assert(TPM_TIS_IS_VALID_LOCTY(newlocty)); + + s->aborting_locty =3D locty; /* may also be TPM_TIS_NO_LOCALITY */ s->next_locty =3D newlocty; /* locality after successful abort */ =20 /* --=20 2.17.1