Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Benjamin LaHaise and committed by
Linus Torvalds
6368087e 0849bfec

+13 -1
+13 -1
drivers/char/ipmi/ipmi_devintf.c
··· 837 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 852 #endif 841 853 842 854 static const struct file_operations ipmi_fops = { 843 855 .owner = THIS_MODULE, 844 856 .unlocked_ioctl = ipmi_unlocked_ioctl, 845 857 #ifdef CONFIG_COMPAT 846 - .compat_ioctl = compat_ipmi_ioctl, 858 + .compat_ioctl = unlocked_compat_ipmi_ioctl, 847 859 #endif 848 860 .open = ipmi_open, 849 861 .release = ipmi_release,