committed by
Jonathan Corbet
parent
09de36137c
commit
25368ca579
@@ -26,6 +26,7 @@
|
|||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
#include <linux/smp_lock.h>
|
||||||
|
|
||||||
#include "tpm.h"
|
#include "tpm.h"
|
||||||
|
|
||||||
@@ -897,6 +898,7 @@ int tpm_open(struct inode *inode, struct file *file)
|
|||||||
int rc = 0, minor = iminor(inode);
|
int rc = 0, minor = iminor(inode);
|
||||||
struct tpm_chip *chip = NULL, *pos;
|
struct tpm_chip *chip = NULL, *pos;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
spin_lock(&driver_lock);
|
spin_lock(&driver_lock);
|
||||||
|
|
||||||
list_for_each_entry(pos, &tpm_chip_list, list) {
|
list_for_each_entry(pos, &tpm_chip_list, list) {
|
||||||
@@ -926,16 +928,19 @@ int tpm_open(struct inode *inode, struct file *file)
|
|||||||
if (chip->data_buffer == NULL) {
|
if (chip->data_buffer == NULL) {
|
||||||
chip->num_opens--;
|
chip->num_opens--;
|
||||||
put_device(chip->dev);
|
put_device(chip->dev);
|
||||||
|
unlock_kernel();
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_set(&chip->data_pending, 0);
|
atomic_set(&chip->data_pending, 0);
|
||||||
|
|
||||||
file->private_data = chip;
|
file->private_data = chip;
|
||||||
|
unlock_kernel();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
spin_unlock(&driver_lock);
|
spin_unlock(&driver_lock);
|
||||||
|
unlock_kernel();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tpm_open);
|
EXPORT_SYMBOL_GPL(tpm_open);
|
||||||
|
Reference in New Issue
Block a user