aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/microcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/microcode.c')
-rw-r--r--arch/i386/kernel/microcode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 55bc365b8753..dd780a00553f 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -81,6 +81,7 @@
81#include <linux/miscdevice.h> 81#include <linux/miscdevice.h>
82#include <linux/spinlock.h> 82#include <linux/spinlock.h>
83#include <linux/mm.h> 83#include <linux/mm.h>
84#include <linux/mutex.h>
84 85
85#include <asm/msr.h> 86#include <asm/msr.h>
86#include <asm/uaccess.h> 87#include <asm/uaccess.h>
@@ -114,7 +115,7 @@ MODULE_LICENSE("GPL");
114static DEFINE_SPINLOCK(microcode_update_lock); 115static DEFINE_SPINLOCK(microcode_update_lock);
115 116
116/* no concurrent ->write()s are allowed on /dev/cpu/microcode */ 117/* no concurrent ->write()s are allowed on /dev/cpu/microcode */
117static DECLARE_MUTEX(microcode_sem); 118static DEFINE_MUTEX(microcode_mutex);
118 119
119static void __user *user_buffer; /* user area microcode data buffer */ 120static void __user *user_buffer; /* user area microcode data buffer */
120static unsigned int user_buffer_size; /* it's size */ 121static unsigned int user_buffer_size; /* it's size */
@@ -444,7 +445,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
444 return -EINVAL; 445 return -EINVAL;
445 } 446 }
446 447
447 down(&microcode_sem); 448 mutex_lock(&microcode_mutex);
448 449
449 user_buffer = (void __user *) buf; 450 user_buffer = (void __user *) buf;
450 user_buffer_size = (int) len; 451 user_buffer_size = (int) len;
@@ -453,7 +454,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
453 if (!ret) 454 if (!ret)
454 ret = (ssize_t)len; 455 ret = (ssize_t)len;
455 456
456 up(&microcode_sem); 457 mutex_unlock(&microcode_mutex);
457 458
458 return ret; 459 return ret;
459} 460}