]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix call zfs_get_name() with invalid parameter
authorGeLiXin <ge.lixin@zte.com.cn>
Tue, 2 Aug 2016 02:58:42 +0000 (10:58 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 8 Aug 2016 19:24:57 +0000 (12:24 -0700)
zfs_get_name() expects a parameter of type zfs_handle_t *zhp , but
gets an invalid parameter type of zfs_handle_t **zhp actually in
libzfs_dataset_cmp(), which may trigger a coredump if called.

libzfs_dataset_cmp() working normally so far, just because all the
callers only give datasets of type ZFS_TYPE_FILESYSTEM to it, we
compared their mountpoint and return, luckily.

Signed-off-by: GeLiXin <ge.lixin@zte.com.cn>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4919

lib/libzfs/libzfs_mount.c

index 5e57adab0c9d4047baed2fffd2bc3779c403f48e..dfb748fc51765b8a9841d63f759033d1f778deac 100644 (file)
@@ -1094,7 +1094,7 @@ libzfs_dataset_cmp(const void *a, const void *b)
        if (gotb)
                return (1);
 
-       return (strcmp(zfs_get_name(a), zfs_get_name(b)));
+       return (strcmp(zfs_get_name(*za), zfs_get_name(*zb)));
 }
 
 /*