Commit 460e0fc2 authored by Robert T. Johnson's avatar Robert T. Johnson Committed by Greg Kroah-Hartman

[PATCH] PATCH: 2.6.7-rc3 drivers/usb/core/devio.c: user/kernel pointer bugs

Since ctrl is copied in from userspace, ctrl.data cannot safely be
dereferenced.  Let me know if you have any questions or if I've made
a mistake.
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent b4a8f23b
...@@ -558,7 +558,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) ...@@ -558,7 +558,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
if (usbfs_snoop) { if (usbfs_snoop) {
dev_info(&dev->dev, "control read: data "); dev_info(&dev->dev, "control read: data ");
for (j = 0; j < ctrl.wLength; ++j) for (j = 0; j < ctrl.wLength; ++j)
printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]); printk ("%02x ", (unsigned char)(tbuf)[j]);
printk("\n"); printk("\n");
} }
if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) {
...@@ -578,7 +578,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) ...@@ -578,7 +578,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
if (usbfs_snoop) { if (usbfs_snoop) {
dev_info(&dev->dev, "control write: data: "); dev_info(&dev->dev, "control write: data: ");
for (j = 0; j < ctrl.wLength; ++j) for (j = 0; j < ctrl.wLength; ++j)
printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]); printk ("%02x ", (unsigned char)(tbuf)[j]);
printk("\n"); printk("\n");
} }
i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment