diff options
-rw-r--r-- | arch/x86/kernel/cpuid.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/msr.c | 14 |
2 files changed, 12 insertions, 9 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index c10ebc4b8e4b..288e7a6598ac 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -62,9 +62,9 @@ static void cpuid_smp_cpuid(void *cmd_block) | |||
62 | static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) | 62 | static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) |
63 | { | 63 | { |
64 | loff_t ret; | 64 | loff_t ret; |
65 | struct inode *inode = file->f_mapping->host; | ||
65 | 66 | ||
66 | lock_kernel(); | 67 | mutex_lock(&inode->i_mutex); |
67 | |||
68 | switch (orig) { | 68 | switch (orig) { |
69 | case 0: | 69 | case 0: |
70 | file->f_pos = offset; | 70 | file->f_pos = offset; |
@@ -77,8 +77,7 @@ static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) | |||
77 | default: | 77 | default: |
78 | ret = -EINVAL; | 78 | ret = -EINVAL; |
79 | } | 79 | } |
80 | 80 | mutex_unlock(&inode->i_mutex); | |
81 | unlock_kernel(); | ||
82 | return ret; | 81 | return ret; |
83 | } | 82 | } |
84 | 83 | ||
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index bd82850e6519..af51ea8400b2 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ----------------------------------------------------------------------- * | 1 | /* ----------------------------------------------------------------------- * |
2 | * | 2 | * |
3 | * Copyright 2000 H. Peter Anvin - All Rights Reserved | 3 | * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -45,9 +45,10 @@ static struct class *msr_class; | |||
45 | 45 | ||
46 | static loff_t msr_seek(struct file *file, loff_t offset, int orig) | 46 | static loff_t msr_seek(struct file *file, loff_t offset, int orig) |
47 | { | 47 | { |
48 | loff_t ret = -EINVAL; | 48 | loff_t ret; |
49 | struct inode *inode = file->f_mapping->host; | ||
49 | 50 | ||
50 | lock_kernel(); | 51 | mutex_lock(&inode->i_mutex); |
51 | switch (orig) { | 52 | switch (orig) { |
52 | case 0: | 53 | case 0: |
53 | file->f_pos = offset; | 54 | file->f_pos = offset; |
@@ -56,8 +57,11 @@ static loff_t msr_seek(struct file *file, loff_t offset, int orig) | |||
56 | case 1: | 57 | case 1: |
57 | file->f_pos += offset; | 58 | file->f_pos += offset; |
58 | ret = file->f_pos; | 59 | ret = file->f_pos; |
60 | break; | ||
61 | default: | ||
62 | ret = -EINVAL; | ||
59 | } | 63 | } |
60 | unlock_kernel(); | 64 | mutex_unlock(&inode->i_mutex); |
61 | return ret; | 65 | return ret; |
62 | } | 66 | } |
63 | 67 | ||