public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Robert T. Johnson" <rtjohnso@eecs.berkeley.edu>
To: linux-usb-devel@lists.sourceforge.net
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: PATCH: 2.6.7-rc3 drivers/usb/core/devio.c: user/kernel pointer bugs
Date: 09 Jun 2004 15:40:50 -0700	[thread overview]
Message-ID: <1086820850.14179.104.camel@dooby.cs.berkeley.edu> (raw)

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,




             reply	other threads:[~2004-06-09 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09 22:40 Robert T. Johnson [this message]
2004-06-10 16:45 ` PATCH: 2.6.7-rc3 drivers/usb/core/devio.c: user/kernel pointer bugs Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1086820850.14179.104.camel@dooby.cs.berkeley.edu \
    --to=rtjohnso@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox