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

Alexander Motin mav at FreeBSD.org
Tue Apr 7 03:19:01 UTC 2020


Author: mav
Date: Tue Apr  7 03:19:00 2020
New Revision: 359686
URL: https://svnweb.freebsd.org/changeset/base/359686

Log:
  Fix panic on kern.cam.ctl.ha_role change after r333446.
  
  MFC after:	1 week
  Sponsored by:	iXsystems, Inc.

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

Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c	Tue Apr  7 02:46:22 2020	(r359685)
+++ head/sys/cam/ctl/ctl_backend_block.c	Tue Apr  7 03:19:00 2020	(r359686)
@@ -2574,8 +2574,10 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, 
 	if (params->lun_size_bytes != 0)
 		be_lun->params.lun_size_bytes = params->lun_size_bytes;
 
-	nvlist_destroy(cbe_lun->options);
-	cbe_lun->options = nvlist_clone(req->args_nvl);
+	if (req->args_nvl != NULL) {
+		nvlist_destroy(cbe_lun->options);
+		cbe_lun->options = nvlist_clone(req->args_nvl);
+	}
 
 	wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY);
 	value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL);

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_ramdisk.c	Tue Apr  7 02:46:22 2020	(r359685)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c	Tue Apr  7 03:19:00 2020	(r359686)
@@ -1252,8 +1252,10 @@ ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc
 	if (params->lun_size_bytes != 0)
 		be_lun->params.lun_size_bytes = params->lun_size_bytes;
 
-	nvlist_destroy(cbe_lun->options);
-	cbe_lun->options = nvlist_clone(req->args_nvl);
+	if (req->args_nvl != NULL) {
+		nvlist_destroy(cbe_lun->options);
+		cbe_lun->options = nvlist_clone(req->args_nvl);
+	}
 
 	wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY);
 	value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL);


More information about the svn-src-all mailing list