mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ceph: fix null pointer dereference
@ 2013-08-05  4:04 Nathaniel Yazdani
  2013-08-05  4:14 ` Sage Weil
  0 siblings, 1 reply; 2+ messages in thread
From: Nathaniel Yazdani @ 2013-08-05  4:04 UTC (permalink / raw)
  To: sage; +Cc: ceph-devel, linux-kernel

	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>
---
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 187bf21..ddff072 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);



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-05  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05  4:04 [PATCH] ceph: fix null pointer dereference Nathaniel Yazdani
2013-08-05  4:14 ` Sage Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®