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

From: Robert T. Johnson
Date: Wed Jun 09 2004 - 17:44:54 EST


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.

Best,
Rob

--- linux-2.6.7-rc3-full/drivers/usb/core/devio.c.orig Wed Jun 9 12:50:34 2004
+++ linux-2.6.7-rc3-full/drivers/usb/core/devio.c Wed Jun 9 12:49:50 2004
@@ -558,7 +558,7 @@ static int proc_control(struct dev_state
if (usbfs_snoop) {
dev_info(&dev->dev, "control read: data ");
for (j = 0; j < ctrl.wLength; ++j)
- printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]);
+ printk ("%02x ", (unsigned char)(tbuf)[j]);
printk("\n");
}
if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) {
@@ -578,7 +578,7 @@ static int proc_control(struct dev_state
if (usbfs_snoop) {
dev_info(&dev->dev, "control write: data: ");
for (j = 0; j < ctrl.wLength; ++j)
- printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]);
+ printk ("%02x ", (unsigned char)(tbuf)[j]);
printk("\n");
}
i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/