From patchwork Wed Jan 3 19:30:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zeng Tao X-Patchwork-Id: 123294 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10054659qgn; Wed, 3 Jan 2018 03:29:43 -0800 (PST) X-Google-Smtp-Source: ACJfBotiZwIs5fz1jymJBFbnZz6vO+voh4WtoSI+9di6dc3/a7/ZCv9+46maObTyTqQoeb1A61mu X-Received: by 10.101.97.178 with SMTP id i18mr989521pgv.408.1514978983497; Wed, 03 Jan 2018 03:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514978983; cv=none; d=google.com; s=arc-20160816; b=qdyGvPOk+4/thYsiNduS/pqjVWhXAM/Ccs9N2GI8hTOsCPkvu/QYHmtCh1dbOv8E8h O4CN22YLk6IJPhaHly/tsbV4n8LqJQ6GBq9bT5FP0POUtv5Yfv7pZyZ7YzoQ+znI/7AN 9MzPhWfxjWhQhVePy0eaKeXQpxokgIAsuD7tU6svzbTIqLzvbFNCztYQt/xQLeheaGyn v7SGx+ZtFTKglhVtuTMhZA7FBCSO8+XniXF/jQIOw4/iak9VStBaz7f2/guhQ8QY4j+7 BWDs5ijx/R/ft1RlISKOSKJRfXRXGh1zuvsEPYMDiCEh5f6g4Fu+TcTwyqsbUGvUy1c4 oTqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=miC/BjgyC+aX35pL6usQMWJd18zTq70wtF4Z+ga8PjQ=; b=yWszBWSvujhd1S2pWJFjBUHy/Xgx7psVDYYIH4cyJMB/JBj3GA44E9Cn65UTb7V/e7 ibNt+Rm3bUDMQLe+5QGE5o2n5qWoDEl7b65BEJxM4wuTVpq5m4fhsE33Q7uTlEm3GVbn bZiYRTBDzV8IwC57FXWk0hYzlGRUzt8RRO/AXSy/Vn0v6p0MwqYD95ni5UZB4zjZUnpZ KDfqUkogw9dFeaO2XviOVGvU7p9HRmDqoh6MW9k1vjx/0d9FRs7d9JOpB9qAeGI+x8In ZGXhgcLoKOzovEj6ezOBCeEaFSqBRJfFqICcqstuxE6Xghx0EquxhlTjVbLMlto0ZGBC BN6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f11si604363plm.77.2018.01.03.03.29.43; Wed, 03 Jan 2018 03:29:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbeACL3j (ORCPT + 28 others); Wed, 3 Jan 2018 06:29:39 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:44902 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752348AbeACL3f (ORCPT ); Wed, 3 Jan 2018 06:29:35 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 10A6456FFA065; Wed, 3 Jan 2018 19:29:22 +0800 (CST) Received: from dessert.huawei.com (10.69.192.158) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.361.1; Wed, 3 Jan 2018 19:29:18 +0800 From: Zeng Tao To: CC: , Subject: [PATCH] optee: fix the dead loop problem when there is signal pending Date: Thu, 4 Jan 2018 03:30:50 +0800 Message-ID: <1515007850-17169-1-git-send-email-prime.zeng@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.158] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when the current process is doing a rpc call from optee, and if there is a signal pending on the process, it will enter dead loop if the tee-supplicant is working correctly, fix the problem by breaking out the loop when the rpc job is finished. Signed-off-by: Zeng Tao --- drivers/tee/optee/supp.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c index b4ea067..170dedb 100644 --- a/drivers/tee/optee/supp.c +++ b/drivers/tee/optee/supp.c @@ -107,6 +107,13 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params, mutex_unlock(&supp->ctx_mutex); if (interruptable) break; + + /* + * if there is signal pending, and the supplicant has finished + * the rpc job, we need to break out the loop + */ + if (try_wait_for_completion(&supp->data_from_supp)) + break; } ret = supp->ret;