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.
Best,
Rob
drivers/usb/core/devio.c renamed from drivers/usb/core/devio.c.orig +2 -2
@@ -558,7 +558,7 @@ static int proc_control(struct dev_stateif (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_stateif (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,
Greg KH
AppliedQuoted 3 lines · Robert T. Johnson
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.
Oops, I added this bug, sorry about that, good catch.
I've applied this to my trees, thanks.
greg k-h