summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-04-04 02:31:30 +0200
committerBrian Behlendorf <[email protected]>2018-04-03 17:31:30 -0700
commit1724eb62debfaa48f5861660615d49a994945d94 (patch)
tree85ff7a05520b67bb50ef0f780bdba8919a8819a3
parentf119d00c1fdcb5812fec6a8ff38c1eb9979a7a57 (diff)
Fix spa reference leak in zfs_ioc_pool_scan
zfs_ioc_pool_scan leaks a spa reference when zc->zc_flags is not a valid pool_scrub_cmd_t: this could happen if the userland binaries and ZFS kernel module differ in version and would prevent the pool from being exported. Reviewed by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #7380
-rw-r--r--module/zfs/zfs_ioctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 8ef4cc46f..1e987dc88 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -1732,12 +1732,12 @@ zfs_ioc_pool_scan(zfs_cmd_t *zc)
spa_t *spa;
int error;
- if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
- return (error);
-
if (zc->zc_flags >= POOL_SCRUB_FLAGS_END)
return (SET_ERROR(EINVAL));
+ if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
+ return (error);
+
if (zc->zc_flags == POOL_SCRUB_PAUSE)
error = spa_scrub_pause_resume(spa, POOL_SCRUB_PAUSE);
else if (zc->zc_cookie == POOL_SCAN_NONE)