diff options
author | Benjamin LaHaise <bcrl@kvack.org> | 2013-05-16 15:04:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-16 16:49:25 -0400 |
commit | 6368087e851e697679af059b4247aca33a69cef3 (patch) | |
tree | 3ec374be28fd14b13b7266fb1d55c0995d09bb37 /drivers/char/ipmi | |
parent | 0849bfece0199a345b0c5143d10cbc1dc228a60f (diff) |
ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex
When a 32 bit version of ipmitool is used on a 64 bit kernel, the
ipmi_devintf code fails to correctly acquire ipmi_mutex. This results in
incomplete data being retrieved in some cases, or other possible failures.
Add a wrapper around compat_ipmi_ioctl() to take ipmi_mutex to fix this.
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r-- | drivers/char/ipmi/ipmi_devintf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 9eb360ff8cab..d5a5f020810a 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, | |||
837 | return ipmi_ioctl(filep, cmd, arg); | 837 | return ipmi_ioctl(filep, cmd, arg); |
838 | } | 838 | } |
839 | } | 839 | } |
840 | |||
841 | static long unlocked_compat_ipmi_ioctl(struct file *filep, unsigned int cmd, | ||
842 | unsigned long arg) | ||
843 | { | ||
844 | int ret; | ||
845 | |||
846 | mutex_lock(&ipmi_mutex); | ||
847 | ret = compat_ipmi_ioctl(filep, cmd, arg); | ||
848 | mutex_unlock(&ipmi_mutex); | ||
849 | |||
850 | return ret; | ||
851 | } | ||
840 | #endif | 852 | #endif |
841 | 853 | ||
842 | static const struct file_operations ipmi_fops = { | 854 | static const struct file_operations ipmi_fops = { |
843 | .owner = THIS_MODULE, | 855 | .owner = THIS_MODULE, |
844 | .unlocked_ioctl = ipmi_unlocked_ioctl, | 856 | .unlocked_ioctl = ipmi_unlocked_ioctl, |
845 | #ifdef CONFIG_COMPAT | 857 | #ifdef CONFIG_COMPAT |
846 | .compat_ioctl = compat_ipmi_ioctl, | 858 | .compat_ioctl = unlocked_compat_ipmi_ioctl, |
847 | #endif | 859 | #endif |
848 | .open = ipmi_open, | 860 | .open = ipmi_open, |
849 | .release = ipmi_release, | 861 | .release = ipmi_release, |