Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2507733pxj; Mon, 10 May 2021 04:48:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2IelcaTZJfRYMvGGvKyQdwf7p4BBO3o3rOfmVLvc1PHjVJ41U4DRc7HHJaWaIk87SMGf9 X-Received: by 2002:a17:907:100e:: with SMTP id ox14mr25848205ejb.484.1620647318377; Mon, 10 May 2021 04:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620647318; cv=none; d=google.com; s=arc-20160816; b=Ls9SATRvte7TCWKorgPwHoYlwE6mLoc6Pp9+Wctx2omMhz8jNchAMBhAMCzU7Lh+D1 qE8gH10ewoALOVW04EqpU+2xyDx2CSQF7FloeXo4gAtr5Gj658a7PYBU9DwHd/JvWXWi Li0I7bupnR9PlO6oVxhdNm9Z7p1D2vMC9Vv2BDOL/V603tXfa489q8Ot7atALUkVGTuc zXRiEvWugTKH+uu4xcP0ZY9c6fMK46VVyrKSh59CdMPZi2EWPo13ZoyLI7QzgYoLAl/y Zv15DS+KHqY7NRccRcISytnUxS1gO4ztlOi9CJs3TbxHAtqKOgI3M3RWZcQoV5tjd70S tWmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G7rKsYxpW2ouelmJjO48+OLhOR/40efQ5Pn/0u4dGes=; b=LHT8TltPDJ6PGgXAHoaAAr2vzdC5bttpN7cTIAJ7eURtOXpxuskQQZij7+nz+VCNB4 qCQCXEMzRudyt+n01ZBNc46akJLJOepnh6DkQeXH5qGLiMPBCF7rx2M9NVPOt08FJ2An hiihHN6rGGLhzR2tPgw+NSYkWs3jVcvZ75/4VqSKd48WB5oHgkEaRA8tOI3w1HsuVixB +NWfq7Tzen4Cr3ARURyJwqkJN92gjEul+hJKImEDbwjSShv3QGeTVTX5EvqD9u5/u5eP uYPSPgIAF0t6rEAVhsLsB+a8IfhFW/DtqP5JUO2zZGjEKxI8i+MiUx7epzmDbDrr0r0+ nhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ESkCZULI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si7512350edv.439.2021.05.10.04.48.15; Mon, 10 May 2021 04:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ESkCZULI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240807AbhEJLgk (ORCPT + 99 others); Mon, 10 May 2021 07:36:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:41704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233315AbhEJKwQ (ORCPT ); Mon, 10 May 2021 06:52:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9CF5A61A2D; Mon, 10 May 2021 10:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643266; bh=B+d/HMwJwK+LTT8jqMhAP0iUKjA1x0huLN614HZVKkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ESkCZULIQlO5ytD4G4k7fTHcfXtxw38VAd7acS9bbYdnb6Onju4dzuvc7ot7OklZk IGPMgOET97w3s3RuAcmggxZA1RBqvFD2nZu4CMr9Yr9aR8obgc2hlaB8vVtJ3YVX2G tGk00tdcmQkcmQamrmyRgWJ7FHg6lq57vXa0+MVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Berger , Jarkko Sakkinen Subject: [PATCH 5.10 246/299] tpm: vtpm_proxy: Avoid reading host log when using a virtual device Date: Mon, 10 May 2021 12:20:43 +0200 Message-Id: <20210510102013.081771093@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Berger commit 9716ac65efc8f780549b03bddf41e60c445d4709 upstream. Avoid allocating memory and reading the host log when a virtual device is used since this log is of no use to that driver. A virtual device can be identified through the flag TPM_CHIP_FLAG_VIRTUAL, which is only set for the tpm_vtpm_proxy driver. Cc: stable@vger.kernel.org Fixes: 6f99612e2500 ("tpm: Proxy driver for supporting multiple emulated TPMs") Signed-off-by: Stefan Berger Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/eventlog/common.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/char/tpm/eventlog/common.c +++ b/drivers/char/tpm/eventlog/common.c @@ -107,6 +107,9 @@ void tpm_bios_log_setup(struct tpm_chip int log_version; int rc = 0; + if (chip->flags & TPM_CHIP_FLAG_VIRTUAL) + return; + rc = tpm_read_log(chip); if (rc < 0) return;