Skip to contentSkip to conversation

Patch "tpm: Fix initialization of the cdev" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Jul 30, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tpm: Fix initialization of the cdev

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tpm-fix-initialization-of-the-cdev.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From ba0ef85479c46a2ab354c2220bdb6152f7f4baf3 Mon Sep 17 00:00:00 2001

From: Jason Gunthorpe <[email protected]>
Date: Tue, 30 Jun 2015 13:15:31 -0600
Subject: tpm: Fix initialization of the cdev

From: Jason Gunthorpe <[email protected]>

commit ba0ef85479c46a2ab354c2220bdb6152f7f4baf3 upstream.

When a cdev is contained in a dynamic structure the cdev parent kobj should be set to the kobj that controls the lifetime of the enclosing structure. In TPM's case this is the embedded struct device.

Also, cdev_init 0's the whole structure, so all sets must be after, not before. This fixes module ref counting and cdev.

---
 drivers/char/tpm/tpm-chip.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm-chip.c +2 -1
@@ -129,8 +129,9 @@ struct tpm_chip *tpmm_chip_alloc(struct
 
 	device_initialize(&chip->dev);
 
-	chip->cdev.owner = chip->pdev->driver->owner;
 	cdev_init(&chip->cdev, &tpm_fops);
+	chip->cdev.owner = chip->pdev->driver->owner;
+	chip->cdev.kobj.parent = &chip->dev.kobj;
 
 	return chip;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/tpm-tpm_crb-fix-le64_to_cpu-conversions-in-crb_acpi_add.patch queue-4.1/tpm-fix-initialization-of-the-cdev.patch