diff options
author | Nathaniel Yazdani <n1ght.4nd.d4y@gmail.com> | 2013-08-05 00:04:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-09 15:24:25 -0500 |
commit | acb2e930c72a1d38504d6d9c1f338562bbb9aa55 (patch) | |
tree | 7bd593470aedaebf8a851e3fc4f28c8c94aeab85 /fs | |
parent | ef0b67e4b1f57d14f314a206338e5dd806a08b21 (diff) |
ceph: fix null pointer dereference
commit c338c07c51e3106711fad5eb599e375eadb6855d upstream.
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 #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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/mds_client.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 63c789eb1e3e..d6a536886472 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -414,6 +414,9 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, | |||
414 | { | 414 | { |
415 | struct ceph_mds_session *s; | 415 | struct ceph_mds_session *s; |
416 | 416 | ||
417 | if (mds >= mdsc->mdsmap->m_max_mds) | ||
418 | return ERR_PTR(-EINVAL); | ||
419 | |||
417 | s = kzalloc(sizeof(*s), GFP_NOFS); | 420 | s = kzalloc(sizeof(*s), GFP_NOFS); |
418 | if (!s) | 421 | if (!s) |
419 | return ERR_PTR(-ENOMEM); | 422 | return ERR_PTR(-ENOMEM); |