svn commit: r253038 - stable/9/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Mon Jul 8 15:59:12 UTC 2013


Author: mav
Date: Mon Jul  8 15:59:11 2013
New Revision: 253038
URL: http://svnweb.freebsd.org/changeset/base/253038

Log:
  MFC r252569:
  Fix NULL-deference kernel panic on attempt of destroying non-existing
  ramdisk-backed CTL LUN.

Modified:
  stable/9/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- stable/9/sys/cam/ctl/ctl_backend_ramdisk.c	Mon Jul  8 15:54:38 2013	(r253037)
+++ stable/9/sys/cam/ctl/ctl_backend_ramdisk.c	Mon Jul  8 15:59:11 2013	(r253038)
@@ -441,6 +441,9 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram
 		snprintf(req->error_str, sizeof(req->error_str),
 			 "%s: error %d returned from ctl_invalidate_lun() for "
 			 "LUN %d", __func__, retval, params->lun_id);
+		mtx_lock(&softc->lock);
+		be_lun->flags &= ~CTL_BE_RAMDISK_LUN_WAITING;
+		mtx_unlock(&softc->lock);
 		goto bailout_error;
 	}
 
@@ -475,14 +478,6 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram
 	return (retval);
 
 bailout_error:
-
-	/*
-	 * Don't leave the waiting flag set.
-	 */
-	mtx_lock(&softc->lock);
-	be_lun->flags &= ~CTL_BE_RAMDISK_LUN_WAITING;
-	mtx_unlock(&softc->lock);
-
 	req->status = CTL_LUN_ERROR;
 
 	return (0);


More information about the svn-src-stable-9 mailing list