aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2020-04-07 03:19:00 +0000
committerAlexander Motin <mav@FreeBSD.org>2020-04-07 03:19:00 +0000
commitefeedddcb58c29eea1bfc076f46f73e34e9f6656 (patch)
tree78d07de9ee62dcaba6fde519dd9d941e81bdb37b /sys/cam/ctl
parenta8b8edb25e1d97b1872f699d31b43633d60d76b8 (diff)
downloadsrc-efeedddcb58c29eea1bfc076f46f73e34e9f6656.tar.gz
src-efeedddcb58c29eea1bfc076f46f73e34e9f6656.zip
Fix panic on kern.cam.ctl.ha_role change after r333446.
MFC after: 1 week Sponsored by: iXsystems, Inc.
Notes
Notes: svn path=/head/; revision=359686
Diffstat (limited to 'sys/cam/ctl')
-rw-r--r--sys/cam/ctl/ctl_backend_block.c6
-rw-r--r--sys/cam/ctl/ctl_backend_ramdisk.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c
index c1c9881efd94..6323c47271f5 100644
--- a/sys/cam/ctl/ctl_backend_block.c
+++ b/sys/cam/ctl/ctl_backend_block.c
@@ -2574,8 +2574,10 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
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);
diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c
index c0f190cc931a..52c983080a7e 100644
--- a/sys/cam/ctl/ctl_backend_ramdisk.c
+++ b/sys/cam/ctl/ctl_backend_ramdisk.c
@@ -1252,8 +1252,10 @@ ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_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);