aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index a5d8bcb40000..e1fc193d9396 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -26,6 +26,7 @@
26#include <linux/poll.h> 26#include <linux/poll.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <linux/smp_lock.h>
29 30
30#include "tpm.h" 31#include "tpm.h"
31 32
@@ -897,6 +898,7 @@ int tpm_open(struct inode *inode, struct file *file)
897 int rc = 0, minor = iminor(inode); 898 int rc = 0, minor = iminor(inode);
898 struct tpm_chip *chip = NULL, *pos; 899 struct tpm_chip *chip = NULL, *pos;
899 900
901 lock_kernel();
900 spin_lock(&driver_lock); 902 spin_lock(&driver_lock);
901 903
902 list_for_each_entry(pos, &tpm_chip_list, list) { 904 list_for_each_entry(pos, &tpm_chip_list, list) {
@@ -926,16 +928,19 @@ int tpm_open(struct inode *inode, struct file *file)
926 if (chip->data_buffer == NULL) { 928 if (chip->data_buffer == NULL) {
927 chip->num_opens--; 929 chip->num_opens--;
928 put_device(chip->dev); 930 put_device(chip->dev);
931 unlock_kernel();
929 return -ENOMEM; 932 return -ENOMEM;
930 } 933 }
931 934
932 atomic_set(&chip->data_pending, 0); 935 atomic_set(&chip->data_pending, 0);
933 936
934 file->private_data = chip; 937 file->private_data = chip;
938 unlock_kernel();
935 return 0; 939 return 0;
936 940
937err_out: 941err_out:
938 spin_unlock(&driver_lock); 942 spin_unlock(&driver_lock);
943 unlock_kernel();
939 return rc; 944 return rc;
940} 945}
941EXPORT_SYMBOL_GPL(tpm_open); 946EXPORT_SYMBOL_GPL(tpm_open);