diff options
| -rw-r--r-- | drivers/char/tpm/tpm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index ae766d868454..ceba6082bd96 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
| @@ -954,13 +954,16 @@ EXPORT_SYMBOL_GPL(tpm_store_cancel); | |||
| 954 | 954 | ||
| 955 | /* | 955 | /* |
| 956 | * Device file system interface to the TPM | 956 | * Device file system interface to the TPM |
| 957 | * | ||
| 958 | * It's assured that the chip will be opened just once, | ||
| 959 | * by the check of is_open variable, which is protected | ||
| 960 | * by driver_lock. | ||
| 957 | */ | 961 | */ |
| 958 | int tpm_open(struct inode *inode, struct file *file) | 962 | int tpm_open(struct inode *inode, struct file *file) |
| 959 | { | 963 | { |
| 960 | int rc = 0, minor = iminor(inode); | 964 | int rc = 0, minor = iminor(inode); |
| 961 | struct tpm_chip *chip = NULL, *pos; | 965 | struct tpm_chip *chip = NULL, *pos; |
| 962 | 966 | ||
| 963 | lock_kernel(); | ||
| 964 | spin_lock(&driver_lock); | 967 | spin_lock(&driver_lock); |
| 965 | 968 | ||
| 966 | list_for_each_entry(pos, &tpm_chip_list, list) { | 969 | list_for_each_entry(pos, &tpm_chip_list, list) { |
| @@ -990,19 +993,16 @@ int tpm_open(struct inode *inode, struct file *file) | |||
| 990 | if (chip->data_buffer == NULL) { | 993 | if (chip->data_buffer == NULL) { |
| 991 | chip->num_opens--; | 994 | chip->num_opens--; |
| 992 | put_device(chip->dev); | 995 | put_device(chip->dev); |
| 993 | unlock_kernel(); | ||
| 994 | return -ENOMEM; | 996 | return -ENOMEM; |
| 995 | } | 997 | } |
| 996 | 998 | ||
| 997 | atomic_set(&chip->data_pending, 0); | 999 | atomic_set(&chip->data_pending, 0); |
| 998 | 1000 | ||
| 999 | file->private_data = chip; | 1001 | file->private_data = chip; |
| 1000 | unlock_kernel(); | ||
| 1001 | return 0; | 1002 | return 0; |
| 1002 | 1003 | ||
| 1003 | err_out: | 1004 | err_out: |
| 1004 | spin_unlock(&driver_lock); | 1005 | spin_unlock(&driver_lock); |
| 1005 | unlock_kernel(); | ||
| 1006 | return rc; | 1006 | return rc; |
| 1007 | } | 1007 | } |
| 1008 | EXPORT_SYMBOL_GPL(tpm_open); | 1008 | EXPORT_SYMBOL_GPL(tpm_open); |
