ipmi: ipmi_devintf: compat_ioctl method failes to take ipmi_mutex
PATCH 1/1 ipmi: ipmi_devintf: compat_ioctl method failes 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. This is probably a candidate for -stable as well.
--- drivers/char/ipmi/ipmi_devintf.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
drivers/char/ipmi/ipmi_devintf.c +13 -1
@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, 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 static const struct file_operations ipmi_fops = { .owner =THIS_MODULE , .unlocked_ioctl = ipmi_unlocked_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = compat_ipmi_ioctl, + .compat_ioctl = unlocked_compat_ipmi_ioctl, #endif .open = ipmi_open, .release = ipmi_release,
Signature · 5 lines
1.7.4.1 -- "Thought is the essence of where you are now."
Yes, you are right. I've pulled this in to my tree. Looking at this, ipmi_mutex really should go away and be replaced bu something that scales better, but I guess it's not that critical for IPMI.
-corey
Quoted 42 lines · Benjamin LaHaise
When a 32 bit version of ipmitool is used on a 64 bit kernel, the
ipmi_devintfcode fails to correctly acquireipmi_mutex. This results in incomplete data being retrieved in some cases, or other possible failures. Add a wrapper aroundcompat_ipmi_ioctl()to takeipmi_mutexto fix this. This is probably a candidate for -stable as well.Signed-off-by Benjamin LaHaise <[email protected]>--- drivers/char/ipmi/ipmi_devintf.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)drivers/char/ipmi/ipmi_devintf.c +13
-1@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, 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 static const struct file_operations ipmi_fops = { .owner =THIS_MODULE , .unlocked_ioctl = ipmi_unlocked_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = compat_ipmi_ioctl, + .compat_ioctl = unlocked_compat_ipmi_ioctl, #endif .open = ipmi_open, .release = ipmi_release,