From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 31 11:10:03 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 878D610656CE for ; Mon, 31 Aug 2009 11:10:03 +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 64FB78FC1E for ; Mon, 31 Aug 2009 11:10: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 n7VBA3oF072896 for ; Mon, 31 Aug 2009 11:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7VBA3mQ072887; Mon, 31 Aug 2009 11:10:03 GMT (envelope-from gnats) Resent-Date: Mon, 31 Aug 2009 11:10:03 GMT Resent-Message-Id: <200908311110.n7VBA3mQ072887@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 11A2D106568D for ; Mon, 31 Aug 2009 11:01:47 +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 008C18FC0A for ; Mon, 31 Aug 2009 11:01:47 +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 n7VB1ko1001097 for ; Mon, 31 Aug 2009 11:01:46 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n7VB1k2Y001096; Mon, 31 Aug 2009 11:01:46 GMT (envelope-from nobody) Message-Id: <200908311101.n7VB1k2Y001096@www.freebsd.org> Date: Mon, 31 Aug 2009 11:01:46 GMT From: Patroklos Argyroudis To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/138387: NULL pointer dereference in lptopen() in file sys/dev/ppbus/lpt.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:10:03 -0000 >Number: 138387 >Category: kern >Synopsis: NULL pointer dereference in lptopen() in file sys/dev/ppbus/lpt.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:10: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 lptopen() in file sys/dev/ppbus/lpt.c at line 489. The NULL check at line 492 should be before the dereference of sc at line 489. >How-To-Repeat: N/A >Fix: Patch attached. Patch attached with submission follows: --- ./sys/dev/ppbus/lpt.c.orig 2009-08-28 16:14:00.000000000 +0300 +++ ./sys/dev/ppbus/lpt.c 2009-08-28 16:21:41.000000000 +0300 @@ -486,12 +486,15 @@ { int trys, err; struct lpt_data *sc = dev->si_drv1; - device_t lptdev = sc->sc_dev; - device_t ppbus = device_get_parent(lptdev); + device_t lptdev; + device_t ppbus; if (!sc) return (ENXIO); + lptdev = sc->sc_dev; + ppbus = device_get_parent(lptdev); + ppb_lock(ppbus); if (sc->sc_state) { lprintf(("%s: still open %x\n", device_get_nameunit(lptdev), >Release-Note: >Audit-Trail: >Unformatted: