From patchwork Tue Apr 5 07:15:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 558364 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EFB8C433FE for ; Tue, 5 Apr 2022 07:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232136AbiDEHw1 (ORCPT ); Tue, 5 Apr 2022 03:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232800AbiDEHvm (ORCPT ); Tue, 5 Apr 2022 03:51:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A02431835E; Tue, 5 Apr 2022 00:47:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02ECC616C4; Tue, 5 Apr 2022 07:47:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D859AC340EE; Tue, 5 Apr 2022 07:47:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649144871; bh=XbcS6J5pKTc2UDgppCxx12CWm5kB7pk+jArTB3TU6mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRyPXqiWub7ZQCR3XYncrv5V2+03gIAEaNjYJSDQWQ1XB9/Oj5hbNPbSiqdScU64C kyLYkCceXakv3CfK6LpD4lfh1IBslX3EadDuFY3aPJ29oYxrjQVr3L0pDKOb/aCYCa 09Mi6kVNXIvEA1eXoMQJl/8fefDBVB4iBT/YoZik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Gonda , Dan Carpenter , Tom Lendacky , Brijesh Singh , Marc Orr , Herbert Xu , John Allen , "David S. Miller" , linux-crypto@vger.kernel.org, Sasha Levin Subject: [PATCH 5.17 0201/1126] crypto: ccp - Ensure psp_ret is always initd in __sev_platform_init_locked() Date: Tue, 5 Apr 2022 09:15:48 +0200 Message-Id: <20220405070413.506377453@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Peter Gonda [ Upstream commit 1e1ec11d3ec3134e05d4710f4dee5f9bd05e828d ] Initialize psp_ret inside of __sev_platform_init_locked() because there are many failure paths with PSP initialization that do not set __sev_do_cmd_locked(). Fixes: e423b9d75e77: ("crypto: ccp - Move SEV_INIT retry for corrupted data") Signed-off-by: Peter Gonda Reported-by: Dan Carpenter Cc: Tom Lendacky Cc: Brijesh Singh Cc: Marc Orr Cc: Herbert Xu Cc: John Allen Cc: "David S. Miller" Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/sev-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 8fd774a10edc..6ab93dfd478a 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -413,7 +413,7 @@ static int __sev_platform_init_locked(int *error) { struct psp_device *psp = psp_master; struct sev_device *sev; - int rc, psp_ret; + int rc, psp_ret = -1; int (*init_function)(int *error); if (!psp || !psp->sev_data)