Skip to content

Commit c338c07

Browse files
nateyazdaniSage Weil
authored andcommitted
ceph: fix null pointer dereference
When register_session() is given an out-of-range argument for mds, ceph_mdsmap_get_addr() will return a null pointer, which would be given to ceph_con_open() & be dereferenced, causing a kernel oops. This fixes bug raspberrypi#4685 in the Ceph bug tracker <http://tracker.ceph.com/issues/4685>. Signed-off-by: Nathaniel Yazdani <n1ght.4nd.d4y@gmail.com> Reviewed-by: Sage Weil <sage@inktank.com>
1 parent 73d9f7e commit c338c07

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎fs/ceph/mds_client.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,9 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
414414
{
415415
struct ceph_mds_session *s;
416416

417+
if (mds >= mdsc->mdsmap->m_max_mds)
418+
return ERR_PTR(-EINVAL);
419+
417420
s = kzalloc(sizeof(*s), GFP_NOFS);
418421
if (!s)
419422
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)