提交 635244c5 编写于 作者: M Matthias Kaehlcke 提交者: Linus Torvalds

fix spinlock usage in hysdn_log_close()

Fix incorrect spinlock use in hysdn_log_close().  The function declared a
spinlock on the stack and used it to 'protect' a shared driver structure.

The patch simply removes the useless code.
Signed-off-by: NMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 13af68ee
...@@ -297,8 +297,6 @@ hysdn_log_close(struct inode *ino, struct file *filep) ...@@ -297,8 +297,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
struct procdata *pd; struct procdata *pd;
hysdn_card *card; hysdn_card *card;
int retval = 0; int retval = 0;
unsigned long flags;
spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
lock_kernel(); lock_kernel();
if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
...@@ -308,7 +306,6 @@ hysdn_log_close(struct inode *ino, struct file *filep) ...@@ -308,7 +306,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
/* read access -> log/debug read, mark one further file as closed */ /* read access -> log/debug read, mark one further file as closed */
pd = NULL; pd = NULL;
spin_lock_irqsave(&hysdn_lock, flags);
inf = *((struct log_data **) filep->private_data); /* get first log entry */ inf = *((struct log_data **) filep->private_data); /* get first log entry */
if (inf) if (inf)
pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ pd = (struct procdata *) inf->proc_ctrl; /* still entries there */
...@@ -331,7 +328,6 @@ hysdn_log_close(struct inode *ino, struct file *filep) ...@@ -331,7 +328,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
inf->usage_cnt--; /* decrement usage count for buffers */ inf->usage_cnt--; /* decrement usage count for buffers */
inf = inf->next; inf = inf->next;
} }
spin_unlock_irqrestore(&hysdn_lock, flags);
if (pd) if (pd)
if (pd->if_used <= 0) /* delete buffers if last file closed */ if (pd->if_used <= 0) /* delete buffers if last file closed */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册