提交 6368087e 编写于 作者: B Benjamin LaHaise 提交者: Linus Torvalds

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: NBenjamin LaHaise <bcrl@kvack.org>
Signed-off-by: NCorey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0849bfec
...@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, ...@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
return ipmi_ioctl(filep, cmd, arg); return ipmi_ioctl(filep, cmd, arg);
} }
} }
static long unlocked_compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
unsigned long arg)
{
int ret;
mutex_lock(&ipmi_mutex);
ret = compat_ipmi_ioctl(filep, cmd, arg);
mutex_unlock(&ipmi_mutex);
return ret;
}
#endif #endif
static const struct file_operations ipmi_fops = { static const struct file_operations ipmi_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.unlocked_ioctl = ipmi_unlocked_ioctl, .unlocked_ioctl = ipmi_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = compat_ipmi_ioctl, .compat_ioctl = unlocked_compat_ipmi_ioctl,
#endif #endif
.open = ipmi_open, .open = ipmi_open,
.release = ipmi_release, .release = ipmi_release,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册