[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f6e5dd7d-30df-26d9-c712-677c127a8026@kunbus.com>
Date: Fri, 5 Feb 2021 16:50:13 +0100
From: Lino Sanfilippo <l.sanfilippo@...bus.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Lino Sanfilippo <LinoSanfilippo@....de>, peterhuewe@....de,
jarkko@...nel.org, stefanb@...ux.vnet.ibm.com,
James.Bottomley@...senpartnership.com, stable@...r.kernel.org,
linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] tpm: fix reference counting for struct tpm_chip
On 05.02.21 16:15, Jason Gunthorpe wrote:
>
> No, the cdev layer holds the refcount on the device while open is
> being called.
>
> Jason
>
Yes, but the reference that is responsible for the chip deallocation is chip->dev
which is linked to chip->cdev and represents /dev/tpm, not /dev/tpmrm.
You are right, we dont have the issue with /dev/tpm for the reason you mentioned.
But /dev/tpmrm is represented by chip->cdevs and keeping this ref held by the cdev
layer wont protect us from the chip being freed (which is the reason why we need
the chip->dev reference in the first place).
And yes, the naming dev/devs/cdev/cdevs is quite confusing :(
Regards,
Lino
Powered by blists - more mailing lists