Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp271540yba; Mon, 20 May 2019 08:26:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyItHMhYaFLW+Pa/XbGGoWF7khW78aSsV8R1aNZDMqD1kN1KIDXs9EhVTI0Oj5FDASrtio7 X-Received: by 2002:a65:4c86:: with SMTP id m6mr74762077pgt.75.1558366018769; Mon, 20 May 2019 08:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558366018; cv=none; d=google.com; s=arc-20160816; b=J6yYvUxn8fuGofKFwOaLqSF2frG5XvlMznJDKzrF97G0+ojQ+3DJgg7AZlFPk7s6yv zDEBFglvmziJ2CezhAa6Hh9Dp97ZoP3N06lBRTsk5XGPGA0yMFYXE1baGhvOhzlwTgfX QxYK+iRvtenHEYq69d35frlk2uv+5tmWcjoeU8NvFLjln+Sg4iDvF1r49v+TSEmN22Hv u1vOFNqA1Yqacy0yurBiBwSBqHqkw9aMzgQnetplcZ6hNc3Z9fEp07UjPOacZTi3KOQk KS4FOTfMg/HFRAECibyDSW4yIqzZtMLJKJoMsu5W+en6ln9J1j+aWNanN50j9eyQCaqq gPBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8Pe5YErRDGRZLbrRBC8EqDC6rUn1tVwWM/HpuRntNLo=; b=VZUC9KkrGlSkzRO4dJr8N+eyNLE5iQuBx6tUdQzpzO6OIiYzBuLcKq3X7tMf9Jz0o8 VuztJ2+GeoHd1x2ClmQBoILw8OQWKSFX7L3f1E8IyczGdD21WrBiM8rugD/G0NE9WR4e Vl0P4Mmej+90iJJqn6704Q3KoxTsJ16NTc1f7qzwf1qO1W5W71ZCzAGHyyg1xLXR6Hc0 21InMYBpnaAFjAJNyt9xxEKuVs+aPpP/g1K2Tf4fM47qauNnRgG8JxxNFSVAx4TkUSBr YnglWOKcXfnUBfuDuj/poa60aPYM/VOGBoIeEuHaF/2RLQcbPpQ3FD7TR5jMQ9u3s5cH aExw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SC2y2dZN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si16608082plt.232.2019.05.20.08.26.43; Mon, 20 May 2019 08:26:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SC2y2dZN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388311AbfETMVu (ORCPT + 99 others); Mon, 20 May 2019 08:21:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:35532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388231AbfETMVn (ORCPT ); Mon, 20 May 2019 08:21:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1BD520815; Mon, 20 May 2019 12:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354903; bh=oU8ELGmWcICzgQj8njCsPkwaruA3CSb1XebZBOO8JIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SC2y2dZNloO747Yd6cx9mVSeX7y5V2zhAZO2v5qQNNXS53HYXqKKRyJBtwU/T6phH NFHFaN6x9vss4TZktqIETo1+l1xrcV8xQYYGe8fSbBxISiUqwfwnIot+2wnlgXQtXX BAQ/Fode1xts7/yvXNDqb47KxUNEluszHOE7YRi0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Herbert Xu , Gary Hook , Brijesh Singh Subject: [PATCH 4.19 022/105] crypto: ccp - Do not free psp_master when PLATFORM_INIT fails Date: Mon, 20 May 2019 14:13:28 +0200 Message-Id: <20190520115248.559897416@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Singh, Brijesh commit f5a2aeb8b254c764772729a6e48d4e0c914bb56a upstream. 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 Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccp/psp-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -935,7 +935,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,