svn commit: r252569 - head/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Wed Jul 3 14:58:12 UTC 2013


Author: mav
Date: Wed Jul  3 14:58:11 2013
New Revision: 252569
URL: http://svnweb.freebsd.org/changeset/base/252569

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

Modified:
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_ramdisk.c	Wed Jul  3 13:57:36 2013	(r252568)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c	Wed Jul  3 14:58:11 2013	(r252569)
@@ -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-all mailing list