From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 31 11:20:07 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CF701065698 for ; Mon, 31 Aug 2009 11:20:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AC4038FC27 for ; Mon, 31 Aug 2009 11:20:03 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7VBK3AG084825 for ; Mon, 31 Aug 2009 11:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7VBK395084824; Mon, 31 Aug 2009 11:20:03 GMT (envelope-from gnats) Resent-Date: Mon, 31 Aug 2009 11:20:03 GMT Resent-Message-Id: <200908311120.n7VBK395084824@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Patroklos Argyroudis Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F536106568F for ; Mon, 31 Aug 2009 11:16:00 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 7DA758FC14 for ; Mon, 31 Aug 2009 11:16:00 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7VBG0gk012623 for ; Mon, 31 Aug 2009 11:16:00 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n7VBG0ml012620; Mon, 31 Aug 2009 11:16:00 GMT (envelope-from nobody) Message-Id: <200908311116.n7VBG0ml012620@www.freebsd.org> Date: Mon, 31 Aug 2009 11:16:00 GMT From: Patroklos Argyroudis To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/138389: NULL pointer dereference in usb_endpoint_foreach() in file sys/dev/usb/usb_device.c X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2009 11:20:07 -0000 >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: