From patchwork Mon Apr 8 20:42:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10890091 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2146C1669 for ; Mon, 8 Apr 2019 20:43:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFED285A0 for ; Mon, 8 Apr 2019 20:43:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F14B3287E5; Mon, 8 Apr 2019 20:43:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E942285A0 for ; Mon, 8 Apr 2019 20:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728834AbfDHUm6 (ORCPT ); Mon, 8 Apr 2019 16:42:58 -0400 Received: from mail-eopbgr790052.outbound.protection.outlook.com ([40.107.79.52]:49376 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726902AbfDHUm6 (ORCPT ); Mon, 8 Apr 2019 16:42:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YV7vB5fMAUMbmcsBFCWnFbhdf+uorkhZ5Q4Y+a9NfPk=; b=xlvvcoZjKp/hB37MkRFqP/NEzzf+lKwrDu/iatAyyNdd/8/nrXaz14buLq9MwncDk2kTz53cLM66BIIjWyx7fYdn11YkzofVAJdK/SVCg37VyT/sFNNvTBbQzMLiJLQ4GNSbqjOtJxmKZ/NWkzTmyf2dRVa3QlkFI+M6LSQVWjs= Received: from DM6PR12MB2682.namprd12.prod.outlook.com (20.176.116.31) by DM6PR12MB3450.namprd12.prod.outlook.com (20.178.198.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.16; Mon, 8 Apr 2019 20:42:55 +0000 Received: from DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::9d54:69c5:d057:80de]) by DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::9d54:69c5:d057:80de%3]) with mapi id 15.20.1771.021; Mon, 8 Apr 2019 20:42:55 +0000 From: "Singh, Brijesh" To: "linux-crypto@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "Singh, Brijesh" , "Lendacky, Thomas" , Herbert Xu , "Hook, Gary" , "stable@vger.kernel.org" Subject: [PATCH] crypto: ccp: Do not free psp_master when PLATFORM_INIT fails Thread-Topic: [PATCH] crypto: ccp: Do not free psp_master when PLATFORM_INIT fails Thread-Index: AQHU7kukjm/4V2FGDEiSE08yTBq3gw== Date: Mon, 8 Apr 2019 20:42:55 +0000 Message-ID: <20190408204241.20393-1-brijesh.singh@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN4PR0801CA0018.namprd08.prod.outlook.com (2603:10b6:803:29::28) To DM6PR12MB2682.namprd12.prod.outlook.com (2603:10b6:5:4a::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 47974031-1ddd-487a-4dc1-08d6bc62c70a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:DM6PR12MB3450; x-ms-traffictypediagnostic: DM6PR12MB3450: x-microsoft-antispam-prvs: x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(396003)(136003)(366004)(346002)(199004)(189003)(86362001)(256004)(14444005)(14454004)(478600001)(25786009)(6506007)(6512007)(26005)(386003)(6486002)(6916009)(102836004)(81156014)(68736007)(106356001)(54906003)(1076003)(2351001)(8676002)(2906002)(71190400001)(4326008)(5640700003)(105586002)(2501003)(71200400001)(50226002)(81166006)(53936002)(476003)(305945005)(3846002)(186003)(52116002)(66066001)(316002)(7736002)(6116002)(36756003)(2616005)(97736004)(486006)(5660300002)(6436002)(99286004)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3450;H:DM6PR12MB2682.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NoNu4lzsFOQlcb0bLmTxFCzIzEXbgY0swlvk8tB+xazPpMuWpsPDIG7WJYxM+t9neHa0945UXa3Atcif0H03lcOUacXJfKNoAbX7tNdHgpoIsuKyzy7JniYQNMgPUZpaUKplvlbaoDlnCujZ1tgORBB1+EBwec7SxgzCJWi7yzXkRayMPLWalDhzcwSzkCTKb7d13aONVNBtMMsE/xm1NNPWyMyrzhhh5MEmgDfkwxuiA2Jy/E2N2QGWTeb7h7U2OSZdayvDnZlh0byNdV6jZ+h8MJ9/IbXkTxF78yvPJ/4dlcuwEeF4/wrrUbLVetVpOOJFcGUBgNMIou2e0tjBV4TdP/tqbt92xRb+R9I/d1gBkTHlnY+sJ9M2/LTVcc2EOL5ZxUAu4+FKJE+Aj/yU9rlOyDBKhTouWd/gFlzKWeU= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47974031-1ddd-487a-4dc1-08d6bc62c70a X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2019 20:42:55.5614 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3450 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, we free the psp_master if the PLATFORM_INIT fails during the SEV FW probe. If psp_master is freed then driver does not invoke the PSP FW. As per SEV FW spec, there are several commands (PLATFORM_RESET, PLATFORM_STATUS, GET_ID etc) which can be executed in the UNINIT state We should not free the psp_master when PLATFORM_INIT fails. Fixes: 200664d5237f ("crypto: ccp: Add SEV support") Cc: Tom Lendacky Cc: Herbert Xu Cc: Gary Hook Cc: stable@vger.kernel.org # 4.19.y Signed-off-by: Brijesh Singh --- drivers/crypto/ccp/psp-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index 80a59be9c80d..656838433f2f 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -1064,7 +1064,7 @@ void psp_pci_init(void) rc = sev_platform_init(&error); if (rc) { dev_err(sp->dev, "SEV: failed to INIT error %#x\n", error); - goto err; + return; } dev_info(sp->dev, "SEV API:%d.%d build:%d\n", psp_master->api_major,