diff options
author | Nathaniel Yazdani <n1ght.4nd.d4y@gmail.com> | 2013-08-05 06:04:30 +0200 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-10 02:52:58 +0200 |
commit | c338c07c51e3106711fad5eb599e375eadb6855d (patch) | |
tree | 8045873c76f120c3beca96a6db7d8fa316cf3eb2 | |
parent | libceph: unregister request in __map_request failed and nofail == false (diff) | |
download | linux-c338c07c51e3106711fad5eb599e375eadb6855d.tar.xz linux-c338c07c51e3106711fad5eb599e375eadb6855d.zip |
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 #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>
-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 3eb1b4470c85..6b40d8112c64 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, { struct ceph_mds_session *s; + if (mds >= mdsc->mdsmap->m_max_mds) + return ERR_PTR(-EINVAL); + s = kzalloc(sizeof(*s), GFP_NOFS); if (!s) return ERR_PTR(-ENOMEM); |