TPM: Missing put_device()
PATCH 1/2 TPM: Missing put_device()
In case one calling tpm_open() whilst other process is owning it, the refcount wouldn't get 0.
This patch depends on [PATCH 3/4][resubmit] TPM: rcu locking, sent on 23 Sep 2008.
Signed-off-by Mimi Zohar <[email protected]>
Signed-off-by Rajiv Andrade <[email protected]>
--- drivers/char/tpm/tpm.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/char/tpm/tpm.c +1 -0
@@ -979,6 +979,7 @@ int tpm_open(struct inode *inode, struct file *file)if (test_and_set_bit (0 , &chip->is_open)) {dev_dbg (chip->dev,"Another process owns this TPM\n" ); +put_device (chip->dev);return -EBUSY ; }
Signature · 1 line
1.5.6.3
PATCH 2/2 TPM: Fixed tpm release timing
As pointed by Jonathan Corbet, the timer must be deleted before flushing the work queue in order to avoid a job being submitted after the chip had been released.
Signed-off-by Rajiv Andrade <[email protected]>
Signed-off-by Mimi Zohar <[email protected]>
CC Jonathan Corbet <[email protected]>
--- drivers/char/tpm/tpm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/tpm/tpm.c +1 -1
@@ -1004,9 +1004,9 @@ int tpm_release(struct inode *inode, struct file *file) {struct tpm_chip *chip = file->private_data; +del_singleshot_timer_sync (&chip->user_read_timer);flush_scheduled_work (); file->private_data =NULL ; -del_singleshot_timer_sync (&chip->user_read_timer);atomic_set (&chip->data_pending,0 );kfree (chip->data_buffer);clear_bit (0 , &chip->is_open);
Signature · 1 line
1.5.6.3