* [PATCH] ipmi: ipmi_devintf: compat_ioctl method failes to take ipmi_mutex
@ 2013-05-13 19:39 Benjamin LaHaise
2013-05-16 17:46 ` Corey Minyard
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin LaHaise @ 2013-05-13 19:39 UTC (permalink / raw)
To: Corey Minyard; +Cc: openipmi-developer, Linux Kernel
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.
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
---
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 9eb360f..d5a5f02 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,
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,
--
1.7.4.1
--
"Thought is the essence of where you are now."
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipmi: ipmi_devintf: compat_ioctl method failes to take ipmi_mutex
2013-05-13 19:39 [PATCH] ipmi: ipmi_devintf: compat_ioctl method failes to take ipmi_mutex Benjamin LaHaise
@ 2013-05-16 17:46 ` Corey Minyard
0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2013-05-16 17:46 UTC (permalink / raw)
To: Benjamin LaHaise; +Cc: openipmi-developer, Linux Kernel
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
On 05/13/2013 02:39 PM, Benjamin LaHaise wrote:
> 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.
>
> Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
> ---
> 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 9eb360f..d5a5f02 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,
> 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,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-16 17:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13 19:39 [PATCH] ipmi: ipmi_devintf: compat_ioctl method failes to take ipmi_mutex Benjamin LaHaise
2013-05-16 17:46 ` Corey Minyard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.