Home
last modified time | relevance | path

Searched hist:a9e6ffbc5b7324b6639ee89028908b1e91ceed51 (Results 1 – 1 of 1) sorted by relevance

/linux/fs/ceph/
H A Dmdsmap.cdiff a9e6ffbc5b7324b6639ee89028908b1e91ceed51 Thu Aug 05 17:14:34 CEST 2021 Tuo Li <islituo@gmail.com> ceph: fix possible null-pointer dereference in ceph_mdsmap_decode()

kcalloc() is called to allocate memory for m->m_info, and if it fails,
ceph_mdsmap_destroy() behind the label out_err will be called:
ceph_mdsmap_destroy(m);

In ceph_mdsmap_destroy(), m->m_info is dereferenced through:
kfree(m->m_info[i].export_targets);

To fix this possible null-pointer dereference, check m->m_info before the
for loop to free m->m_info[i].export_targets.

[ jlayton: fix up whitespace damage
only kfree(m->m_info) if it's non-NULL ]

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>