Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp949496ybl; Wed, 11 Dec 2019 10:01:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzkGuWjG91DiDSyNamcWKGpQwewR5vxfWciur+cCgcvxj5yMpMuFexwmxT0DHpD6/7z2B9F X-Received: by 2002:aca:90a:: with SMTP id 10mr3842125oij.81.1576087299563; Wed, 11 Dec 2019 10:01:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576087299; cv=none; d=google.com; s=arc-20160816; b=xbOtaNto/jb3Rb35YtA7ty9xKz8kTX2FDex9N4OqwVOc85lvYYJTcDn05WMB3EVRHW AFHaCNjS9/UsC23xY1E4RyZ4gt+IZyDzkB3vJBR+oX5tLYO3k0ll6skLRp+Xyr3aG/fC Gd3AYGs+enp+6yf/sCMNGmmFsT6riM4aE7CwPDAd4l2NCParQnNPpvF1/f9+MnkmFS+C lUREniXecbUvloUxP0hYxCPUropwMHgC4RluZp4nlnGuOPxepdjzqgRb5KuMOHsTFvWd mCiodHRlVzSLYev2kABaI6aODM9HR11aS1YQNvjeDMnIgk/pGY5m1mwpCyBTK8AEaDTI rJXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CwxPTLbC3ogUJeNq/IWD5pR3nEwZlnWRgd7NffLHYH4=; b=nrlyEV410i2So49ncSDzfVc+4Cgyw4z3+bVPadNPb4yVajq0vXQIv0X8lTdApeSueo v6yV/zsFeZ+qBd7DYVpf++jcH3d1Qdi+QHIwHRaJnMgu5CbqGkTf/OStU4N40TvkRPTN R2shbuEiD1zIhXYLIFfl7aZKhsm0r1Ut2rkaruIK/CEEuckP1wVmkSQVTHl0PXNsaALz 8O4raVy2e7EPUwhY+x0dmUk/bEvO56tj+B8WX2lW0FYGRNjJU0/oiA5M7iKKCzVqpjAY XlEyct7R8fdGvMswS/nXe+N7+bS+7qEOrHan6C6fuM0Eopi2n0V39HKFxrepC3nWyp3X UyPQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l19si1525037oib.48.2019.12.11.10.01.25; Wed, 11 Dec 2019 10:01:39 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730839AbfLKSAv (ORCPT + 99 others); Wed, 11 Dec 2019 13:00:51 -0500 Received: from mga11.intel.com ([192.55.52.93]:47202 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730578AbfLKSAu (ORCPT ); Wed, 11 Dec 2019 13:00:50 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 10:00:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,302,1571727600"; d="scan'208";a="220507774" Received: from cmclough-mobl.ger.corp.intel.com (HELO localhost) ([10.251.85.152]) by fmsmga001.fm.intel.com with ESMTP; 11 Dec 2019 10:00:46 -0800 Date: Wed, 11 Dec 2019 20:00:45 +0200 From: Jarkko Sakkinen To: Tadeusz Struk Cc: peterz@infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, jgg@ziepe.ca, mingo@redhat.com, jeffrin@rajagiritech.edu.in, linux-integrity@vger.kernel.org, will@kernel.org, peterhuewe@gmx.de Subject: Re: [PATCH] tpm: fix WARNING: lock held when returning to user space Message-ID: <20191211180045.GN4516@linux.intel.com> References: <34e5340f-de75-f20e-7898-6142eac45c13@intel.com> <157601267151.12904.7408818232910113434.stgit@tstruk-mobl1> <20191211175119.GI4516@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191211175119.GI4516@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 11, 2019 at 07:52:02PM +0200, Jarkko Sakkinen wrote: > On Tue, Dec 10, 2019 at 01:17:51PM -0800, Tadeusz Struk wrote: > > When an application sends TPM commands in NONBLOCKING mode > > the driver holds chip->tpm_mutex returning from write(), > > which triggers WARNING: lock held when returning to user space! > > To silence this warning the driver needs to release the mutex > > and acquire it again in tpm_dev_async_work() before sending > > the command. > > This commit message is nonsense ATM. The code leaves locks held, > which is unacceptable. > > Silencing warnings is worst possible rationale for a code change > that I can think of starting from the fact that is straight out > wrong and malicious. The code change, however, seems to be doing the right thing. Please bundle it with the test and fix the commit message appropriately. /Jarkko