VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   30 Branches   50 Tags
author: Tuo Li <islituo@gmail.com> 2021-08-05 08:14:34 -0700 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-09-08 08:50:20 +0200 commit: c7858c55cb5d84646f8cffad97cad0ae7335fb6d parent: 1ab026cbc7c464ff468b5543cb6d7d63d22a43dc
Commit Summary:
ceph: fix possible null-pointer dereference in ceph_mdsmap_decode()
Diffstat:
1 file changed, 5 insertions, 3 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index abd9af7727ad..3c444b9cb17b 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -394,9 +394,11 @@ void ceph_mdsmap_destroy(struct ceph_mdsmap *m)
 {
 	int i;
 
-	for (i = 0; i < m->possible_max_rank; i++)
-		kfree(m->m_info[i].export_targets);
-	kfree(m->m_info);
+	if (m->m_info) {
+		for (i = 0; i < m->possible_max_rank; i++)
+			kfree(m->m_info[i].export_targets);
+		kfree(m->m_info);
+	}
 	kfree(m->m_data_pg_pools);
 	kfree(m);
 }