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: 13218128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A354C77B72 for ; Thu, 20 Apr 2023 08:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=58ZSnmL+3fWpKhhpvO528tu3Gq+UjPGU+iUQS06DOzM=; b=ry1PHsRqLoUbGL 3azu1WwkWAYlzjtJdESo+x8uYqzLPSJNlFZZYe4dylyMxtfNDHCRF+ZkbrAq3YVAa2EIFEdJZTU7n GzwukXbDW7WHuQMwwJrX2R0d79Yt67Im+QQgW74PuHe1LmfHLqLXpGe9Qzx5unUUvljWQNkV2jY/D hNpl9CdNfHYC0x+57VAyggTJTCSgCSZ5Byo0BiTR/zrBGQzprrP6BSmwZnhIrFPaKqYxdIg2o+7W8 Jv9b14o0BFnPkv3eJfzCBuAU6tWTmhP6DsmTpcjGS9zdDy/lJXNbI1FRNVtSO9XT1ku6x4PhRdK94 QbUdyryh2zjnD2ktx2TA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppPQU-007MyL-2B; Thu, 20 Apr 2023 08:13:58 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppPQS-007Mxi-20 for linux-arm-kernel@lists.infradead.org; Thu, 20 Apr 2023 08:13:58 +0000 Received: by mail-wm1-x32a.google.com with SMTP id he11-20020a05600c540b00b003ef6d684102so2629834wmb.3 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=eUuFS2Jne8+4/6fx0sszM138cUEfSbfTgBlKTvbzRE4ve19Yi6VYve9eTDYF5uwAOu 56h8QyKuW3L4dLLtpMtoW1rgT4SN880sR5kkYkPR60QQ7kRjpHpVKBs8f010Jf5WpKZz u8SQKR9VBcgOCY8VtyCbayWJxlLomLOl2L9wRMl3fmI6gCkUI5KVQvMinXM6qMgt4a8J 1IiNIggc9rEPo0arrcCGYllTw49M3mLl1wmNwk7iw4kUWMX5MUJNVTwB8j7NVFGP3yyc qj3OPt956XWVMvVdoSviXYR0hYKXkFcOJkzOTISn9uTSl2cipSdLeUgAJmMpUnMl+UgA MFuw== X-Gm-Message-State: AAQBX9dIkDeJXvkoR4hbmGipvdmrxY+mqFbRJJqQc24Uh3u9/vcd9T3M vYESpnoyYYJSf7A4scrRJ1bqwQ== X-Google-Smtp-Source: AKy350bY5ALOG7fBQ562Q0YtPy9gegb2h3M/pLLKmdyxQxniDs84D2dAzj8R3iGjOIwdEI+QNEoOHg== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230420_011356_663967_37C6AA4A X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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;