Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp58164pxj; Wed, 16 Jun 2021 20:13:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSrtdDONtBQtqUB3MbvC8zinWwOxVnsKBJUhgP0J//FT0PZGnp1zGQ8Qrg2x/O2UU9bCP7 X-Received: by 2002:a05:6602:2c47:: with SMTP id x7mr2016323iov.26.1623899609486; Wed, 16 Jun 2021 20:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623899609; cv=none; d=google.com; s=arc-20160816; b=kiAUP4rG8cWHeqKQ6naVd1eZLIu20tT1/mJ7GaTNtqUSCRKCPg0fWMPE+OU45w3Ypq ZSGj1CDwk78k4qpgDnlGm/JyKRIOZ936+Rv7+/U6dCcKt38tEC42wV5srAz8UZgCFwnX aw0TzOlN1B7CczKCW3Jkf4l0qbvkVOGOl59tRN4OCZX8Xu6pciw+TBjYaobwQcTrq32W lOr4rtvkaMNX9vkOpJqEX0kJhRdXsgw7ZGTOoBA1zxaL9GJUf5OEKaHicKaw5MRTG91m pdz8vgGTbeuenvZRWAdFgCRctR2Cks/TjyJ437pbtWsvPl9o40a5p9MmtwkauAjaeZqT oS6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Bi8dbucrJcy0W1D0dg2PU0hOFJEuVy1iH+Z01lR7RNU=; b=f7bfYSfjxIEGvoiRwYJBLQpie214ejgWz6iENkB1NlZBeIcFjhs3NCCDqpair3fRI3 RgrLxNUuy/C/1ibLkuxJeZfMiNRRaQfoMMclnQ4rlR9GJxgf3F+mJRcsFPguwgL0Cn17 oPcFHctLvsslaCCppG9xuOTyhQ3Ci8zwUw6sZevPYxLm91nSFCsO3H8cLQ/5h8J3Iyk/ BSIrVJfw2A5nBU5hW5gOsW+QuPqZO05ChrgL2H6cdOK67IGiVDiy5Tvc7PTurdUyjckm rlYlTk/7+0pLwVkVJyCJYJUHaOJIaAMCFuRvzRt/HzGO/2jcnM4mHLPlNj4O0AKKlpMA E0nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="Po/xUUsH"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p11si4309426ioo.38.2021.06.16.20.13.15; Wed, 16 Jun 2021 20:13:29 -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=@ziepe.ca header.s=google header.b="Po/xUUsH"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232154AbhFPSzM (ORCPT + 99 others); Wed, 16 Jun 2021 14:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbhFPSzK (ORCPT ); Wed, 16 Jun 2021 14:55:10 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1458C061574 for ; Wed, 16 Jun 2021 11:53:03 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id x6so264402qvx.4 for ; Wed, 16 Jun 2021 11:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Bi8dbucrJcy0W1D0dg2PU0hOFJEuVy1iH+Z01lR7RNU=; b=Po/xUUsHLApF2WJxJQfD/YuH91EnTAYSVD1+At+SSHlxCPOKFaw9xtnwZTdsdk+DFK BayPMchZJUB930+dPPSSh6lWVh5oNdEfz0ZlYGrkMYI+kXaq2wTWBOJrrBOC9k4PWSr1 8hIkaUTo/FBInVYQX6XbTssCK+3z++KEDgkUq5wSDCT9uzsyBZTJsCc3z2wfo0Rp4Gy2 4cbslr3Il3c2If01RtYElCx2dZ910hiCKH1YNGwB9F2N7sVsv3uHa+qdu+OMxzoNAf87 opIFJMYgELd/xKzFT3icow5eXFKEouovuysAXmGye9Pr/YeSiYq+hnD5pV2l7lnxmNoA Yhog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Bi8dbucrJcy0W1D0dg2PU0hOFJEuVy1iH+Z01lR7RNU=; b=JQG596uWhrPwNLih55b+CB6vwWuz5kX1qD+CaIVAz4XiYSH9/17piaF/CXAWpsSuM+ lKfv0vTBRMj592JDU2WGy8rAigDr6BsXwIse062CaAIsElQbo2nqfHa8VqdBLRoS9kFT xXSi5hmQlDDKzsEMsTcicZuLiKV9X9dJpfTDnY5Elg+LG6tjbYNZQqneZzpMKOICWFpm Exivv3aPby9iJBOrDwhqAYclCQxoZQ7UPKNk223osOdukPUm0awdzPMGfw3PMM3vYb84 d8l2ApdjW/rslEy2DI3V6XFyZhrnTcjnlVftnimPZiv3vANsE5iecq5BJDflVlCxW5lk fPMQ== X-Gm-Message-State: AOAM5308NIusMdoETbkEa13WTj7BVSw/Ue4gqwTv8LPCDgyeBtmF8wIo gkCtIrLnkap/N12NsrBJtA9qpA== X-Received: by 2002:a0c:8563:: with SMTP id n90mr1504110qva.41.1623869583161; Wed, 16 Jun 2021 11:53:03 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-113-94.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.113.94]) by smtp.gmail.com with ESMTPSA id i11sm61968qkl.95.2021.06.16.11.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 11:53:02 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1ltaes-007kLT-09; Wed, 16 Jun 2021 15:53:02 -0300 Date: Wed, 16 Jun 2021 15:53:01 -0300 From: Jason Gunthorpe To: Vincent Whitchurch Cc: Peter Huewe , Jarkko Sakkinen , Stefan Berger , kernel@axis.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] tpm: Fix tpmrm reference counting Message-ID: <20210616185301.GV1096940@ziepe.ca> References: <20210615091410.17007-1-vincent.whitchurch@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210615091410.17007-1-vincent.whitchurch@axis.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 15, 2021 at 11:14:08AM +0200, Vincent Whitchurch wrote: > The code added by commit 8979b02aaf1d6de8 ("tpm: Fix reference count to > main device") tries to take an extra reference to the main device only > for TPM2 by looking at the flags, but the flags are actually not set > at the time when tpm_chip_alloc() is called, so no extra reference is > ever taken, leading to a use-after-free if the TPM modules are removed > when the tpmrm device is in use. Please read this https://lore.kernel.org/linux-integrity/20210205172528.GP4718@ziepe.ca/ Jason