svn commit: r354114 - stable/12/stand/libsa/zfs
Toomas Soome
tsoome at FreeBSD.org
Sat Oct 26 10:33:22 UTC 2019
Author: tsoome
Date: Sat Oct 26 10:33:21 2019
New Revision: 354114
URL: https://svnweb.freebsd.org/changeset/base/354114
Log:
MFC r353757:
loader: zfs_fmtdev can crash when pool discovery did fail and we have no spa
When zfs probe did fail and no spa was created, but zfs_fmtdev() is called,
we will crash while dereferencing spa (NULL pointer dereference).
Modified:
stable/12/stand/libsa/zfs/zfs.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/stand/libsa/zfs/zfs.c
==============================================================================
--- stable/12/stand/libsa/zfs/zfs.c Sat Oct 26 08:37:28 2019 (r354113)
+++ stable/12/stand/libsa/zfs/zfs.c Sat Oct 26 10:33:21 2019 (r354114)
@@ -769,11 +769,16 @@ zfs_fmtdev(void *vdev)
if (dev->dd.d_dev->dv_type != DEVT_ZFS)
return (buf);
- if (dev->pool_guid == 0) {
- spa = STAILQ_FIRST(&zfs_pools);
+ /* Do we have any pools? */
+ spa = STAILQ_FIRST(&zfs_pools);
+ if (spa == NULL)
+ return (buf);
+
+ if (dev->pool_guid == 0)
dev->pool_guid = spa->spa_guid;
- } else
+ else
spa = spa_find_by_guid(dev->pool_guid);
+
if (spa == NULL) {
printf("ZFS: can't find pool by guid\n");
return (buf);
More information about the svn-src-all
mailing list