* [PATCH 1/2] TPM: Missing put_device()
@ 2008-09-24 19:34 Rajiv Andrade
2008-09-24 19:34 ` [PATCH 2/2] TPM: Fixed tpm release timing Rajiv Andrade
0 siblings, 1 reply; 2+ messages in thread
From: Rajiv Andrade @ 2008-09-24 19:34 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, serue, safford, debora, Mimi Zohar
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 <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index f6bbc1d..ab03b4d 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -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;
}
--
1.5.6.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] TPM: Fixed tpm release timing
2008-09-24 19:34 [PATCH 1/2] TPM: Missing put_device() Rajiv Andrade
@ 2008-09-24 19:34 ` Rajiv Andrade
0 siblings, 0 replies; 2+ messages in thread
From: Rajiv Andrade @ 2008-09-24 19:34 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, serue, safford, debora, Mimi Zohar, Jonathan Corbet
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 <srajiv@linux.vnet.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
CC: Jonathan Corbet <corbet@lwn.net>
---
drivers/char/tpm/tpm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index ab03b4d..8d090d3 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -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);
--
1.5.6.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-24 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24 19:34 [PATCH 1/2] TPM: Missing put_device() Rajiv Andrade
2008-09-24 19:34 ` [PATCH 2/2] TPM: Fixed tpm release timing Rajiv Andrade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®