Skip to content

Commit 6368087

Browse files
bcrltorvalds
authored andcommitted
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>
1 parent 0849bfe commit 6368087

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/char/ipmi/ipmi_devintf.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
837837
return ipmi_ioctl(filep, cmd, arg);
838838
}
839839
}
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+
}
840852
#endif
841853

842854
static const struct file_operations ipmi_fops = {
843855
.owner = THIS_MODULE,
844856
.unlocked_ioctl = ipmi_unlocked_ioctl,
845857
#ifdef CONFIG_COMPAT
846-
.compat_ioctl = compat_ipmi_ioctl,
858+
.compat_ioctl = unlocked_compat_ipmi_ioctl,
847859
#endif
848860
.open = ipmi_open,
849861
.release = ipmi_release,

0 commit comments

Comments
 (0)