Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2020 13:52:34 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r361252 - stable/12/sys/cam/ctl
Message-ID:  <202005191352.04JDqYh1021805@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue May 19 13:52:34 2020
New Revision: 361252
URL: https://svnweb.freebsd.org/changeset/base/361252

Log:
  MFC r359686: Fix panic on kern.cam.ctl.ha_role change after r333446.

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

Modified: stable/12/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- stable/12/sys/cam/ctl/ctl_backend_block.c	Tue May 19 13:44:32 2020	(r361251)
+++ stable/12/sys/cam/ctl/ctl_backend_block.c	Tue May 19 13:52:34 2020	(r361252)
@@ -2586,8 +2586,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: stable/12/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- stable/12/sys/cam/ctl/ctl_backend_ramdisk.c	Tue May 19 13:44:32 2020	(r361251)
+++ stable/12/sys/cam/ctl/ctl_backend_ramdisk.c	Tue May 19 13:52:34 2020	(r361252)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005191352.04JDqYh1021805>