From owner-svn-src-all@FreeBSD.ORG Sat Dec 11 08:44:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5793F106564A; Sat, 11 Dec 2010 08:44:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46E1C8FC13; Sat, 11 Dec 2010 08:44:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBB8iAZj000267; Sat, 11 Dec 2010 08:44:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBB8iASt000265; Sat, 11 Dec 2010 08:44:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201012110844.oBB8iASt000265@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 11 Dec 2010 08:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216371 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Dec 2010 08:44:10 -0000 Author: hselasky Date: Sat Dec 11 08:44:10 2010 New Revision: 216371 URL: http://svn.freebsd.org/changeset/base/216371 Log: Fix race in devfs by using LIST_FIRST() instead of LIST_FOREACH_SAFE() when freeing the devfs private data entries. Reviewed by: kib MFC after: 3 days Approved by: thompsa (mentor) Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Sat Dec 11 08:32:16 2010 (r216370) +++ head/sys/kern/kern_conf.c Sat Dec 11 08:44:10 2010 (r216371) @@ -926,7 +926,7 @@ static void destroy_devl(struct cdev *dev) { struct cdevsw *csw; - struct cdev_privdata *p, *p1; + struct cdev_privdata *p; mtx_assert(&devmtx, MA_OWNED); KASSERT(dev->si_flags & SI_NAMED, @@ -974,7 +974,7 @@ destroy_devl(struct cdev *dev) dev_unlock(); notify_destroy(dev); mtx_lock(&cdevpriv_mtx); - LIST_FOREACH_SAFE(p, &cdev2priv(dev)->cdp_fdpriv, cdpd_list, p1) { + while ((p = LIST_FIRST(&cdev2priv(dev)->cdp_fdpriv)) != NULL) { devfs_destroy_cdevpriv(p); mtx_lock(&cdevpriv_mtx); }