From patchwork Tue Apr 5 07:20:54 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: 556318 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 AFB95C433EF for ; Tue, 5 Apr 2022 10:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240226AbiDEKyz (ORCPT ); Tue, 5 Apr 2022 06:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244560AbiDEJl2 (ORCPT ); Tue, 5 Apr 2022 05:41:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41996BBE09; Tue, 5 Apr 2022 02:27:00 -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 D2E036165C; Tue, 5 Apr 2022 09:26:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B584BC385A2; Tue, 5 Apr 2022 09:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150819; bh=nYwfEtMFbMAE6czzSoryuRv5ziTITHooF+OvNTqn/1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WflVkywDr0T1Fdut3pd1zeI0Vj6Km4nxDkvgZmW8+81ftWgQfgfeVSm7sY1+UjYOi RH9K3IBzBbor1YG0Fy08PULsmGzbvaSNfNOlyAZAwCCACP0G6jNJpVzFN6+9QCP/Ow nVJXcaKMsxHoTDdyiHVWGvKfGkyDvI8OD80qoEig= 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.15 192/913] crypto: ccp - Ensure psp_ret is always initd in __sev_platform_init_locked() Date: Tue, 5 Apr 2022 09:20:54 +0200 Message-Id: <20220405070345.613291615@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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 e2806ca3300a..5040726fc119 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -241,7 +241,7 @@ static int __sev_platform_init_locked(int *error) struct psp_device *psp = psp_master; struct sev_data_init data; struct sev_device *sev; - int psp_ret, rc = 0; + int psp_ret = -1, rc = 0; if (!psp || !psp->sev_data) return -ENODEV;