Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1333443
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get |
| Date | 2016-02-14 08:00 +0100 |
| Message-ID | <r1YP1-7Co-13@gated-at.bofh.it> (permalink) |
| References | <r1vWF-5KL-7@gated-at.bofh.it> <r1vWG-5KL-21@gated-at.bofh.it> <r1WWS-6oa-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Feb 14, 2016 at 06:55:12AM +0200, Jarkko Sakkinen wrote: > On Fri, Feb 12, 2016 at 05:04:29PM -0700, Jason Gunthorpe wrote: > > This was missed during the struct device conversion, we > > need to hold a kref on the chip to make sure it isn't freed. > > > > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> > > I'm bit confused about this patch. What is the regression if this > needs The patch is simply totally broken, the placement of the get_device is wrong: > > @@ -53,6 +53,8 @@ struct tpm_chip *tpm_chip_find_get(int chip_num) > > chip = pos; > > break; > > } > > + > > + get_device(&chip->dev); It needs to be moved up two lines before the break, into the if statement. As for the urgency - today the tpm core relies on module locking to try and prevent tpm_chip_unregister from racing with stuff like the above. That is totally broken in modern kernels, but it is what the core tries to do. Within that framework the get/put are not needed because of the module locking. The only time these additional get/put do anything is when we are racing with tpm_unregister, but if we are racing with unregister then there are much bigger problems and things will crash anyhow. So, this patch is just a tiny step. The revised version of this patch with the rw_sem attempts to address the complete race. Jason
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] Various struct device cleanups Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 01:10 +0100
[PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 01:10 +0100
Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-13 11:10 +0100
Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 16:50 +0100
Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-14 06:00 +0100
Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-14 08:00 +0100
Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-14 09:10 +0100
[PATCH 3/3] tpm: Get rid of devname Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 01:10 +0100
Re: [PATCH 3/3] tpm: Get rid of devname Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 02:20 +0100
Re: [PATCH 3/3] tpm: Get rid of devname Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-14 06:20 +0100
[PATCH 2/3] tpm: Get rid of chip->pdev Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 01:10 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 02:20 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 03:10 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-13 04:40 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-14 06:30 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-14 08:00 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-14 09:10 +0100
Re: [tpmdd-devel] [PATCH 2/3] tpm: Get rid of chip->pdev Stefan Berger <stefanb@linux.vnet.ibm.com> - 2016-02-13 16:50 +0100
Re: [tpmdd-devel] [PATCH 2/3] tpm: Get rid of chip->pdev Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-02-14 08:10 +0100
Re: [PATCH 2/3] tpm: Get rid of chip->pdev Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-14 06:20 +0100
csiph-web