Re: [PATCH 2/3] tpm: Get rid of chip->pdev

From: Jason Gunthorpe
Date: Fri Feb 12 2016 - 21:01:20 EST


On Fri, Feb 12, 2016 at 08:31:21PM -0500, Stefan Berger wrote:

> The vtpm driver will introduce chip->priv, which will point to
> vtpm_dev. For

Why not just use chip->vendor.priv? Aka TPM_VPRIV

> this reason we need to hold a reference to the vtpm_dev->dev in the
> front end.

Yes, but all drivers are like this. Most will just kfree their priv immediately

All sane Linux core subsystems guarentee that after their unregister
returns the driver callbacks will be done and uncallable, it is a bug
that tpm does not do this.

> So we could optimize it:
>
> if (chip->priv)
> get_device(chip->dev.parent);

That doesn't address the race

Jason