summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorloli10K <[email protected]>2019-09-16 19:46:59 +0200
committerBrian Behlendorf <[email protected]>2019-09-16 10:46:59 -0700
commitfcd37b622b9fb3a9673b483c59fb2d1a8c368177 (patch)
tree5c784151ff4b3b451298a5bc6f48d6bdc863089d /module/zfs
parentb24771a8c9e4752456a2db69476388fb45a3f751 (diff)
Device removal of indirect vdev panics the kernel
This commit fixes a NULL pointer dereference triggered in spa_vdev_remove_top_check() by trying to "zpool remove" an indirect vdev. Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #9327
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/vdev_removal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c
index 4ce7b559e..549087163 100644
--- a/module/zfs/vdev_removal.c
+++ b/module/zfs/vdev_removal.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019 by Delphix. All rights reserved.
+ * Copyright (c) 2019, loli10K <[email protected]>. All rights reserved.
*/
#include <sys/zfs_context.h>
@@ -1964,6 +1965,9 @@ spa_vdev_remove_top_check(vdev_t *vd)
if (vd != vd->vdev_top)
return (SET_ERROR(ENOTSUP));
+ if (!vdev_is_concrete(vd))
+ return (SET_ERROR(ENOTSUP));
+
if (!spa_feature_is_enabled(spa, SPA_FEATURE_DEVICE_REMOVAL))
return (SET_ERROR(ENOTSUP));