kern/138389: NULL pointer dereference in usb_endpoint_foreach() in
file sys/dev/usb/usb_device.c
Patroklos Argyroudis
argp at census-labs.com
Mon Aug 31 11:20:07 UTC 2009
>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:
More information about the freebsd-bugs
mailing list