From dc15c610ca7c4ff53e45774adf52122f579a51e2 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 24 Aug 2017 16:32:25 -0500 Subject: [PATCH] scoutfs: fix null pointer deref in get_manifest_refs() When we're not the server node, 'mani' is NULL, so derefing it in our loop causes a crash. That said, we don't need it anyway - the loop will eventually end when our btree walk (via btree_prev_overlap_or_next()) ends. Signed-off-by: Mark Fasheh --- kmod/src/manifest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kmod/src/manifest.c b/kmod/src/manifest.c index 1748dc5b..0ce44fe3 100644 --- a/kmod/src/manifest.c +++ b/kmod/src/manifest.c @@ -458,7 +458,6 @@ static int get_manifest_refs(struct super_block *sb, struct scoutfs_key_buf *end, struct list_head *ref_list) { - DECLARE_MANIFEST(sb, mani); struct scoutfs_manifest_btree_key *mkey; struct scoutfs_manifest_entry ment; SCOUTFS_BTREE_ITEM_REF(iref); @@ -499,7 +498,7 @@ static int get_manifest_refs(struct super_block *sb, * cached items to their locks. */ mkey_len = init_btree_key(mkey, 1, 0, key); - for (i = 1; i < mani->nr_levels; i++) { + for (i = 1; ; i++) { mkey->level = i; /* XXX should use level counts to skip searches */