Re: svn commit: r237335 - head/sys/cam/scsi
On 20 June 2012 22:25, Alexander Motin <mav@freebsd.org> wrote:
> Author: mav
> Date: Wed Jun 20 18:25:51 2012
> New Revision: 237335
> URL: http://svn.freebsd.org/changeset/base/237335
>
> Log:
> =A0Check status of cam_periph_hold() inside cdclose(). =A0If cd device wa=
s
> =A0invalidated while open, cam_periph_hold() will return error and won't
> =A0get the reference. =A0Following reference release will crash the syste=
m.
>
> =A0Sponsored by: iXsystems, Inc.
> =A0MFC after: =A0 =A03 days
>
> Modified:
> =A0head/sys/cam/scsi/scsi_cd.c
>
> Modified: head/sys/cam/scsi/scsi_cd.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:00:26 2012 =A0 =A0 =A0 =A0(=
r237334)
> +++ head/sys/cam/scsi/scsi_cd.c Wed Jun 20 18:25:51 2012 =A0 =A0 =A0 =A0(=
r237335)
> @@ -1041,6 +1041,7 @@ cdclose(struct disk *dp)
> =A0{
> =A0 =A0 =A0 =A0struct =A0cam_periph *periph;
> =A0 =A0 =A0 =A0struct =A0cd_softc *softc;
> + =A0 =A0 =A0 int error;
>
> =A0 =A0 =A0 =A0periph =3D (struct cam_periph *)dp->d_drv1;
> =A0 =A0 =A0 =A0if (periph =3D=3D NULL)
> @@ -1049,7 +1050,11 @@ cdclose(struct disk *dp)
> =A0 =A0 =A0 =A0softc =3D (struct cd_softc *)periph->softc;
>
> =A0 =A0 =A0 =A0cam_periph_lock(periph);
> - =A0 =A0 =A0 cam_periph_hold(periph, PRIBIO);
> + =A0 =A0 =A0 if ((error =3D cam_periph_hold(periph, PRIBIO)) !=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cam_periph_unlock(periph);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cam_periph_release(periph);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0);
> + =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH=
,
> =A0 =A0 =A0 =A0 =A0 =A0("cdclose\n"));
Hi.
Does it fix the reported crash with cd refcount underflow? It seems so.
http://lists.freebsd.org/pipermail/freebsd-stable/2012-June/068175.html
--=20
wbr,
pluknet
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
討論串 (同標題文章)