[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-bugs
Subject:    kern/138389: NULL pointer dereference in usb_endpoint_foreach() in
From:       Patroklos Argyroudis <argp () census-labs ! com>
Date:       2009-08-31 11:16:00
Message-ID: 200908311116.n7VBG0ml012620 () www ! freebsd ! org
[Download RAW message or body]


> Number:         138389
> Category:       kern
> Synopsis:       NULL pointer dereference in usb_endpoint_foreach() in file \
>                 sys/dev/usb/usb_device.c
> Confidential:   no
> Severity:       non-critical
> Priority:       low
> Responsible:    freebsd-bugs
> State:          open
> Quarter:        
> Keywords:       
> Date-Required:
> Class:          sw-bug
> Submitter-Id:   current-users
> Arrival-Date:   Mon Aug 31 11:20:03 UTC 2009
> Closed-Date:
> Last-Modified:
> Originator:     Patroklos Argyroudis
> Release:        8.0-CURRENT
> Organization:
census, inc
> Environment:
N/A
> Description:
There is a NULL pointer dereference in usb_endpoint_foreach() in file \
sys/dev/usb/usb_device.c at line 370.  The check against NULL at line 373 should be \
before the dereference of udev at line 370.
> How-To-Repeat:
N/A
> Fix:
Patch attached.

Patch attached with submission follows:

--- ./sys/dev/usb/usb_device.c.orig	2009-08-28 16:27:54.000000000 +0300
+++ ./sys/dev/usb/usb_device.c	2009-08-28 16:29:01.000000000 +0300
@@ -367,12 +367,14 @@
 struct usb_endpoint *
 usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep)
 {
-	struct usb_endpoint *ep_end = udev->endpoints + udev->endpoints_max;
+	struct usb_endpoint *ep_end;
 
 	/* be NULL safe */
 	if (udev == NULL)
 		return (NULL);
 
+	ep_end = udev->endpoints + udev->endpoints_max;
+
 	/* get next endpoint */
 	if (ep == NULL)
 		ep = udev->endpoints;


> Release-Note:
> Audit-Trail:
> Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic