Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2474539pxj; Mon, 10 May 2021 04:00:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyubonqrN++JldTtCLwHJchth2tNrfX7tSaurlPqTqgb+Ul8/F89/ClUZCnMMKurUu8vcXg X-Received: by 2002:a5e:dc48:: with SMTP id s8mr1506575iop.128.1620644451645; Mon, 10 May 2021 04:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644451; cv=none; d=google.com; s=arc-20160816; b=oIRNvG/Vn+vCM1GzEVbm7GrDW+NW5M9kiGkjwpfLRARECo39LrO7r2vUHYxzDX+Mra UUsWwpoiR9rOe8txaCm8Kl2GoV29oTRY7SQkQlC9LbmNLLOrlJ8K78K9NuSQG0UbPBhS T+XigsKuLtWT92UwU1UK40AXuqcsVKeKr3sq+eK7k2rhIBHZxxR5hGpjP+Cmj0VkzwVU 2TQyxBoLb7vjTV38O52nvoEQI9voLSL5h1ulGaG2iLyDSFCElFqYP4ppm0sqiQv9GEwA RlhYUokTT+hkaRy79mmedS5jQNCcB8kzD9mEJj3CCVzpqoze2pbMJQi5ExFVbQfoIFui +4nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QF7u0soi5VgURQT2kshFvH2tmkhRNIjnygj58CtPADY=; b=CWZ4+/wt5RS7WljKD4E/KfA70DWuevnDdAKvRfVRXjfhpDTjXIUBLgcLLXKBSry5O4 hOnnhz3dnqGzgmNhOTs/mfTgSVsx7Vss+45kzQz6nCSfEvMlR1InEtzdSNez0bhRF7oc SCpxVvIJlkNVdD5jQNdMfZt1sxOlve27MsHFynRSr4a3gWleyNMZ8SajZBY4WSm+aTHW FpxXyzVTdPfescTItjNzFRX+WgrMwcmG68sWNXwg5MKnISe1ifkZ5hhvsBtnt65zIYyC 7PLbS72qh4dGF7olB90d3zDqn8p6VTeLNSGkqTXdRSxMK2xMjh/dcs+W2sJSU9CCo07+ lVgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gey8JW9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l2si16565872ios.47.2021.05.10.04.00.38; Mon, 10 May 2021 04:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gey8JW9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234710AbhEJK4x (ORCPT + 99 others); Mon, 10 May 2021 06:56:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:52048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232935AbhEJKos (ORCPT ); Mon, 10 May 2021 06:44:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B7BD61582; Mon, 10 May 2021 10:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642854; bh=0B3ppj/Z+oUjmrvE4pPZDD4gi3C+apA+BcViiJEhQUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gey8JW9mA+sKvPNBkrqJ+VWX3W0dG/gfeF/u1aKQMXuIgCTdXD5hsS3MyD/BpYqH0 9XxJULgQysN/5JZ0fLXIj70kApzpHU0PqG+rCQQlQmdFCYNlrI4DLuS+ljuFhoza5h SouRsYrPgk4ph+ldalq5MJoT//NHiKrqEFjS7Q78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Jens Wiklander , Jerome Forissier , Sasha Levin Subject: [PATCH 5.10 078/299] tee: optee: do not check memref size on return from Secure World Date: Mon, 10 May 2021 12:17:55 +0200 Message-Id: <20210510102007.502641118@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jerome Forissier [ Upstream commit c650b8dc7a7910eb25af0aac1720f778b29e679d ] When Secure World returns, it may have changed the size attribute of the memory references passed as [in/out] parameters. The GlobalPlatform TEE Internal Core API specification does not restrict the values that this size can take. In particular, Secure World may increase the value to be larger than the size of the input buffer to indicate that it needs more. Therefore, the size check in optee_from_msg_param() is incorrect and needs to be removed. This fixes a number of failed test cases in the GlobalPlatform TEE Initial Configuratiom Test Suite v2_0_0_0-2017_06_09 when OP-TEE is compiled without dynamic shared memory support (CFG_CORE_DYN_SHM=n). Reviewed-by: Sumit Garg Suggested-by: Jens Wiklander Signed-off-by: Jerome Forissier Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin --- drivers/tee/optee/core.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index cf4718c6d35d..63542c1cc291 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -79,16 +79,6 @@ int optee_from_msg_param(struct tee_param *params, size_t num_params, return rc; p->u.memref.shm_offs = mp->u.tmem.buf_ptr - pa; p->u.memref.shm = shm; - - /* Check that the memref is covered by the shm object */ - if (p->u.memref.size) { - size_t o = p->u.memref.shm_offs + - p->u.memref.size - 1; - - rc = tee_shm_get_pa(shm, o, NULL); - if (rc) - return rc; - } break; case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT: case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT: -- 2.30.2