From owner-cvs-src@FreeBSD.ORG Wed Aug 17 17:04:43 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92F3616A41F; Wed, 17 Aug 2005 17:04:43 +0000 (GMT) (envelope-from nate@root.org) Received: from www.cryptography.com (li-22.members.linode.com [64.5.53.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D4A943D46; Wed, 17 Aug 2005 17:04:43 +0000 (GMT) (envelope-from nate@root.org) Received: from [10.0.0.33] (adsl-67-119-74-222.dsl.sntc01.pacbell.net [67.119.74.222]) by www.cryptography.com (8.12.8/8.12.8) with ESMTP id j7HH4go5008554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 17 Aug 2005 10:04:45 -0700 Message-ID: <43036E25.6010508@root.org> Date: Wed, 17 Aug 2005 10:04:37 -0700 From: Nate Lawson User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Poul-Henning Kamp References: <20050817082000.0B70016A437@hub.freebsd.org> In-Reply-To: <20050817082000.0B70016A437@hub.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/fs/devfs devfs_vnops.c src/sys/kern kern_conf.c src/sys/sys conf.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2005 17:04:43 -0000 Poul-Henning Kamp wrote: > phk 2005-08-17 08:19:53 UTC > > FreeBSD src repository > > Modified files: > sys/fs/devfs devfs_vnops.c > sys/kern kern_conf.c > sys/sys conf.h > Log: > Handle device drivers with D_NEEDGIANT in a way which does not > penalize the 'good' drivers: Allocate a shadow cdevsw and populate > it with wrapper functions which grab Giant > > Revision Changes Path > 1.120 +0 -24 src/sys/fs/devfs/devfs_vnops.c > 1.190 +155 -9 src/sys/kern/kern_conf.c > 1.226 +1 -0 src/sys/sys/conf.h > > > static void > prep_cdevsw(struct cdevsw *devsw) > { > + struct cdevsw *dsw2; > > + if (devsw->d_flags & D_NEEDGIANT) > + dsw2 = malloc(sizeof *dsw2, M_DEVT, M_WAITOK); > + else > + dsw2 = NULL; > dev_lock(); > > if (devsw->d_version != D_VERSION_01) { Is it guaranteed that prep_cdevsw() won't be called twice without a call to fini_cdevsw()? Otherwise, the shadow cdevsw could leak when its pointer is set to NULL. I'm not familiar with this code, just asking. -- Nate