Blame SOURCES/autofs-5.1.7-cater-for-empty-mounts-list-in-mnts_get_expire_list.patch

96dc52
autofs-5.1.7 - cater for empty mounts list in mnts_get_expire_list()
96dc52
96dc52
From: Ian Kent <raven@themaw.net>
96dc52
96dc52
Coverity: var_deref_model: Passing null pointer "tree" to
96dc52
	  "tree_traverse_inorder", which dereferences it.
96dc52
96dc52
This obviously can't happen but deal with it anyway to quiet Coverity.
96dc52
96dc52
Signed-off-by: Ian Kent <raven@themaw.net>
96dc52
---
96dc52
 CHANGELOG    |    1 +
96dc52
 lib/mounts.c |    6 ++++--
96dc52
 2 files changed, 5 insertions(+), 2 deletions(-)
96dc52
96dc52
diff --git a/CHANGELOG b/CHANGELOG
96dc52
index b79aebc8..b1b28888 100644
96dc52
--- a/CHANGELOG
96dc52
+++ b/CHANGELOG
96dc52
@@ -64,6 +64,7 @@
96dc52
 - fix missing lock release in mount_subtree().
96dc52
 - fix double free in parse_mapent().
96dc52
 - refactor lookup_prune_one_cache() a bit.
96dc52
+- cater for empty mounts list in mnts_get_expire_list().
96dc52
 
96dc52
 25/01/2021 autofs-5.1.7
96dc52
 - make bind mounts propagation slave by default.
96dc52
diff --git a/lib/mounts.c b/lib/mounts.c
96dc52
index 883e3743..3996eb5e 100644
96dc52
--- a/lib/mounts.c
96dc52
+++ b/lib/mounts.c
96dc52
@@ -1445,8 +1445,10 @@ void mnts_get_expire_list(struct list_head *mnts, struct autofs_point *ap)
96dc52
 		}
96dc52
 	}
96dc52
 
96dc52
-	tree_traverse_inorder(tree, tree_mnt_expire_list_work, mnts);
96dc52
-	tree_free(tree);
96dc52
+	if (tree) {
96dc52
+		tree_traverse_inorder(tree, tree_mnt_expire_list_work, mnts);
96dc52
+		tree_free(tree);
96dc52
+	}
96dc52
 done:
96dc52
 	mnts_hash_mutex_unlock();
96dc52
 }