From owner-freebsd-current@FreeBSD.ORG Sun Jul 8 19:19:42 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0078316A400 for ; Sun, 8 Jul 2007 19:19:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id 98B0D13C480 for ; Sun, 8 Jul 2007 19:19:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1I7cIE-000Gjh-Tn for current@freebsd.org; Sun, 08 Jul 2007 22:19:40 +0300 Received: from deviant.kiev.zoral.com.ua (root@[10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l68JJULe059774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Jul 2007 22:19:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l68JJTOs020191; Sun, 8 Jul 2007 22:19:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l68JJTOt020190; Sun, 8 Jul 2007 22:19:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 8 Jul 2007 22:19:28 +0300 From: Kostik Belousov To: Tai-hwa Liang Message-ID: <20070708191928.GM2200@deviant.kiev.zoral.com.ua> References: <20070703180141.GJ2200@deviant.kiev.zoral.com.ua> <20070705144443.GV2200@deviant.kiev.zoral.com.ua> <20070707160042.GJ2200@deviant.kiev.zoral.com.ua> <07070809441413.59322@www.mmlab.cse.yzu.edu.tw> <20070708024815.GK2200@deviant.kiev.zoral.com.ua> <0707082155317.77206@www.mmlab.cse.yzu.edu.tw> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XCKmtPOB2gS6QFgg" Content-Disposition: inline In-Reply-To: <0707082155317.77206@www.mmlab.cse.yzu.edu.tw> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.90.3, clamav-milter version 0.90.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on skuns.kiev.zoral.com.ua X-Scanner-Signature: f216f799903dddc2f9accd11d8a1fded X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1190 [July 06 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: current@freebsd.org Subject: Re: HEADS UP: destroy_dev_sched() KPI in the tree X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2007 19:19:42 -0000 --XCKmtPOB2gS6QFgg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 08, 2007 at 10:00:14PM +0800, Tai-hwa Liang wrote: > On Sun, 8 Jul 2007, Kostik Belousov wrote: > >On Sun, Jul 08, 2007 at 09:47:41AM +0800, Tai-hwa Liang wrote: > [...] > >> Though it was reviewed before destroy_dev_sched() KPI enters to the= =20 > >> tree, > >>I'd be appreciate it if you can reviewed the attached patch again. > >So, this is still the problem for scsi_targ ? > > > >It probably make sense to postpone free of softc until all threads > >finished using it. You may use destroy_dev_sched_cb() to run the > >function after the device is actually destroyed. It would just call > >free(). >=20 > Probably; however, I did not see any code inside scsi_target.c to > detach or unregister the scsi_target device. Will this cause any > cdev leakage? This is not about cdev linkage. Immediately after call to destriy_dev_sched(), driver code frees dev' softc. Thus, if any thread is still inside cdev method, it could access freed memory. Postponing the call to free until all threads leave the cdev methods would eliminate this bug. --XCKmtPOB2gS6QFgg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGkTi/C3+MBN1Mb4gRAmtgAKCRxpL3BAXtEd8J3PVs/RnXzPfzbQCfUvTu LExgW/rSqyHjCynJeGlK3Ck= =pajg -----END PGP SIGNATURE----- --XCKmtPOB2gS6QFgg--