tpm: Add explicit chip->ops locking for sysfs attributes.
Subsystems (2)
PATCH v2 1/1 tpm: Add explicit chip->ops locking for sysfs attributes.
Add explicit chip->ops locking for all sysfs attributes. This lets us support those attributes on tpm2 devices.
Signed-off-by Guenter Roeck <[email protected]>
---
v2: It makes sense to actually compile the code.
drivers/char/tpm/tpm-chip.c | 4 -- drivers/char/tpm/tpm-sysfs.c | 127 ++++++++++++++++++++++++++++++++----------- 2 files changed, 94 insertions(+), 37 deletions(-)
drivers/char/tpm/tpm-chip.c +0 -4
@@ -149,10 +149,6 @@ static void tpm_devs_release(struct device *dev)* Issues a TPM2_Shutdown command prior to loss of power, as required by the * TPM 2.0 spec. * Then, calls bus- and device- specific shutdown code. -* -* XXX: This codepath relies on the fact that sysfs is not enabled for -* TPM2: sysfs uses an implicit lock on chip->ops, so this could race if TPM2 -* has sysfs support enabled before TPM sysfs's implicit locking is fixed. */ static int tpm_class_shutdown (struct device *dev) {
drivers/char/tpm/tpm-sysfs.c +94 -33
253 lines not on this page · raw message
Signature · 1 line
2.7.4
Jason Gunthorpe
reviewerQuoted 9 lines · Guenter Roeck
Add explicit
chip->opslocking for all sysfs attributes. This lets us support those attributes on tpm2 devices.Signed-off-by Guenter Roeck <[email protected]>v2: It makes sense to actually compile the code.
drivers/char/tpm/tpm-chip.c | 4 -- drivers/char/tpm/tpm-sysfs.c | 127 ++++++++++++++++++++++++++++++++----------- 2 files changed, 94 insertions(+), 37 deletions(-)
I haven't exhaustively checked this, but as the originator of the comment, this looks broadly like the right approach to me.
Cheers,
Jason