summaryrefslogtreecommitdiffstats
path: root/fs/ceph/mdsmap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-08-26 11:18:30 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-08-26 11:18:30 -0700
commit97d8cc20085f63cfbf0b123295e12cf9ad66a03c (patch)
tree941cd6fdcfb95da0d11ba83262bd248bde6fe9b1 /fs/ceph/mdsmap.c
parent9b49ceb8545b8eca68c03388a07ecca7caa5d9c1 (diff)
parenta9e6ffbc5b7324b6639ee89028908b1e91ceed51 (diff)
downloadlinux-97d8cc20085f63cfbf0b123295e12cf9ad66a03c.tar.bz2
Merge tag 'ceph-for-5.14-rc8' of git://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov: "Two memory management fixes for the filesystem" * tag 'ceph-for-5.14-rc8' of git://github.com/ceph/ceph-client: ceph: fix possible null-pointer dereference in ceph_mdsmap_decode() ceph: correctly handle releasing an embedded cap flush
Diffstat (limited to 'fs/ceph/mdsmap.c')
-rw-r--r--fs/ceph/mdsmap.c8
1 files 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);
}