From patchwork Thu Apr 20 07:49:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 85773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp167436vqo; Thu, 20 Apr 2023 01:27:13 -0700 (PDT) X-Google-Smtp-Source: AKy350YBJH+db+VMULLRo5qWVMVM3XjU1WvoPcncnDJU3B3cmzsQAJYQqUKeT0iznIbrPl+EN8xz X-Received: by 2002:a17:90b:390f:b0:246:9170:a9be with SMTP id ob15-20020a17090b390f00b002469170a9bemr970898pjb.13.1681979233338; Thu, 20 Apr 2023 01:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681979233; cv=none; d=google.com; s=arc-20160816; b=AVpvfayRLb/+oz7iE6nBXA4xmNLpCWKcDaRMuuPJKdRVfq7vchknFGPe7uCj3pUUQF ImQHCPgpzixCOQ4zYQ4zxUxVHTiWqiX18B9/ZsWuPe3ymBp9oRvhgh/Uj7ADaqSfPBYw AupFt47oCjmQYrk5xUpdn/V+ZZ9vyXTenUsUD03g4+3nflFoxILK4fKkJOQOtBTp/0Uo R5B6VRKy6RYFftDkAiA14KlJ7OWeR82SLozHmaz/3hx8IO6B4bVr2yUJymrWEN/QfA1s x95ycvvnmPo0qDwSE+4R4nRUb8lc6D9qMD8+XTtoHH/SyfLRDCp5zDniaPuuGbICDNqk 3vyA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=5r/u4BLyA+TkKxbgEa0Nh6lx6vF8gZ05AKnHgjn7q0c=; b=cplEEjmnju+ICvXipgpOtZL2YqLR95dUMZkrZN3FXrXemkO+YNF+VU09yPu0GR3tdL MbUfdcdM+lTmgy/5l8+j0cRSnmyF2WBb0HyD7BlnPsZiIjUa6KM5bdRHk+aIXlyjsT0M fnVHiSb311k57HBp2tU/kaUNLc+wpjgmIli9fH26dEXP05WYpav0w/7FTU4gir8KgBs0 RjH1fCzfcd3O74DGZpnbwh6MVLWqOCcXzigNA1GHbPkeXv0e5FW8Cdsyd21ZAiwd7oCq dVJ7a7ryz+5XPgQBx0H3Hms83jLyUiu/4OS1YRJtQGrQSre5P/U2YnbafpwZFONVmquc Os3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=huuImGBj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a17090a940900b00233f3034302si3697577pjo.46.2023.04.20.01.26.58; Thu, 20 Apr 2023 01:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=huuImGBj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233868AbjDTIOH (ORCPT + 99 others); Thu, 20 Apr 2023 04:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234358AbjDTIOE (ORCPT ); Thu, 20 Apr 2023 04:14:04 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB436359D for ; Thu, 20 Apr 2023 01:13:55 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id l31-20020a05600c1d1f00b003f1718d89b2so2674163wms.0 for ; Thu, 20 Apr 2023 01:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681978434; x=1684570434; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5r/u4BLyA+TkKxbgEa0Nh6lx6vF8gZ05AKnHgjn7q0c=; b=huuImGBjgWXJ16g1iU2/TFT3gYDaXdQZPK168kYgwswuas8+RsfwrHgCbOpoLNvc3U EhN4tP4/C5MJgwxfNR7Uyku1E0SfE2b+L9hK7jva4I2WOnEJEEqALH2Ntbayu12pdHmi X8IAQ7yCdNqy5c9TfHoZvelPWu9+uKyWbkQhAeMt5oMa0bPtx1r7zt1nc3eyAUNA4N/3 /l6afMsbYMcrD3i3nJAJP684ciAuRvTE4UsownPpw2SCSaYu1QudXXuxVNfMOUX0EvSG uEWt7Z83DFlExMCoTe7vH+4eT6GS15BtKpzO6Oycc6XjgWdHy3BLNNAit2bD25a4SI3B lToA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681978434; x=1684570434; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5r/u4BLyA+TkKxbgEa0Nh6lx6vF8gZ05AKnHgjn7q0c=; b=HFo0ov472MPS5htiN3ylqtA4hg+u4y5ZSJqyv7tMGsvL1bWoqe+RT7DzEQJjMMS91A n6v6NosGFN28Py+gbTwP1Yv2F42HCwy0B4xIFYf4rum5OuPqvAm5oCj6Q0iVd020f0RV oFG80rzrhY7lM6635qtplOSNXOS8RE2GULBzx6+i9MeiLLMLC/Gp2+lijywjiJNNikcf qk+8JIVmlPA8pdZX8J1iWGmkiyW0T9U2v++UDUN887+iT4rb0gOwwUSJKNPnxv168gnC aLhFlDM/PuOjS/AAuVV7n00Kg9gcKwhbgsBY2Cl22MWyLYphaOPMbpMJNewyHbEtoUKO RWgw== X-Gm-Message-State: AAQBX9eSA/IHsghuJw1YzJxcD5IwWTBIKStxTa1ikWgyS6iWXxrmLskm yM5YctKKrGBzCIXS889fJ9nyHtF6qQ9pwx721DY= X-Received: by 2002:a05:600c:210:b0:3f1:731e:cdb1 with SMTP id 16-20020a05600c021000b003f1731ecdb1mr590090wmi.6.1681978433906; Thu, 20 Apr 2023 01:13:53 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1192:45a3:5e7a:a040:b243:429e]) by smtp.gmail.com with ESMTPSA id v11-20020a5d43cb000000b002ff77b033b1sm1292035wrr.33.2023.04.20.01.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 01:13:53 -0700 (PDT) From: Etienne Carriere To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Jens Wiklander , Sumit Garg , Ard Biesheuvel , op-tee@lists.trustedfirmware.org, Etienne Carriere , kernel test robot , Dan Carpenter Subject: [PATCH] optee: fix uninited async notif value Date: Thu, 20 Apr 2023 09:49:23 +0200 Message-Id: <20230420074923.2281303-1-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763683056814289820?= X-GMAIL-MSGID: =?utf-8?q?1763683056814289820?= Fixes an uninitialized variable in irq_handler() that could lead to unpredictable behavior in case OP-TEE fails to handle SMC function ID OPTEE_SMC_GET_ASYNC_NOTIF_VALUE. This change ensures that in that case get_async_notif_value() properly reports there are no notification event. Reported-by: kernel test robot Link: https://lore.kernel.org/r/202304200755.OoiuclDZ-lkp@intel.com/ Reported-by: Dan Carpenter Link: https://lore.kernel.org/all/d9b7f69b-c737-4cb3-8e74-79fe00c934f9@kili.mountain/ Fixes: 6749e69c4dad ("optee: add asynchronous notifications") Signed-off-by: Etienne Carriere Reviewed-by: Sumit Garg --- drivers/tee/optee/smc_abi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c index de7ac9a46354..6d3705770755 100644 --- a/drivers/tee/optee/smc_abi.c +++ b/drivers/tee/optee/smc_abi.c @@ -1001,8 +1001,10 @@ static u32 get_async_notif_value(optee_invoke_fn *invoke_fn, bool *value_valid, invoke_fn(OPTEE_SMC_GET_ASYNC_NOTIF_VALUE, 0, 0, 0, 0, 0, 0, 0, &res); - if (res.a0) + if (res.a0) { + *value_valid = false; return 0; + } *value_valid = (res.a2 & OPTEE_SMC_ASYNC_NOTIF_VALUE_VALID); *value_pending = (res.a2 & OPTEE_SMC_ASYNC_NOTIF_VALUE_PENDING); return res.a1;