All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maurus Cuelenaere <mcuelenaere@gmail.com>
To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 1/2] USB: gadget: fix null pointer dereference on non-dual speed gadgets
Date: Mon, 17 May 2010 21:12:23 +0200	[thread overview]
Message-ID: <4BF19517.90301@gmail.com> (raw)

The composite driver doesn't verify whether gadgets are dual speed when using
the high speed descriptors.

USB drivers don't set usb_function->hs_descriptors on non-dual speed gadgets,
which result in dereferencing a NULL pointer in set_config().

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
---
 drivers/usb/gadget/composite.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 09289bb..fa07267 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -431,7 +431,8 @@ static int set_config(struct usb_composite_dev *cdev,
 		 * function's setup callback instead of the current
 		 * configuration's setup callback.
 		 */
-		if (gadget->speed == USB_SPEED_HIGH)
+		if (gadget->speed == USB_SPEED_HIGH
+		    && gadget_is_dualspeed(gadget))
 			descriptors = f->hs_descriptors;
 		else
 			descriptors = f->descriptors;
-- 
1.7.1



                 reply	other threads:[~2010-05-17 19:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4BF19517.90301@gmail.com \
    --to=mcuelenaere@gmail.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.