Date: Sun, 8 Jul 2007 22:19:28 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw> Cc: current@freebsd.org Subject: Re: HEADS UP: destroy_dev_sched() KPI in the tree Message-ID: <20070708191928.GM2200@deviant.kiev.zoral.com.ua> In-Reply-To: <0707082155317.77206@www.mmlab.cse.yzu.edu.tw> References: <20070703180141.GJ2200@deviant.kiev.zoral.com.ua> <E1I6SAN-0000by-Bt@cs1.cs.huji.ac.il> <20070705144443.GV2200@deviant.kiev.zoral.com.ua> <c21e92e20707070536x6c8053c0l7ecad5a5bfa6de15@mail.gmail.com> <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>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070708191928.GM2200>