Skip to contentSkip to conversation

ceph: check rinfo->dir_dir before dereferencing it.

PATCH In review Yan, Zheng 2 participants 3 messages Sep 28, 2013 – Sep 30, 2013 Ceph client

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/2 ceph: check rinfo->dir_dir before dereferencing it.

From: "Yan, Zheng" <[email protected]>

---
 fs/ceph/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/inode.c +2 -1
index 49d4de0..6f0a35c 100644
@@ -1288,7 +1288,8 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
 	u64 r_readdir_offset = req->r_readdir_offset;
 	u32 frag = le32_to_cpu(rhead->args.readdir.frag);
 
-	if (le32_to_cpu(rinfo->dir_dir->frag) != frag) {
+	if (rinfo->dir_dir &&
+	    le32_to_cpu(rinfo->dir_dir->frag) != frag) {
 		dout("readdir_prepopulate got new frag %x -> %x\n",
 		     frag, le32_to_cpu(rinfo->dir_dir->frag));
 		frag = le32_to_cpu(rinfo->dir_dir->frag);
Signature · 1 line
1.8.1.4
author
#1 lore raw

PATCH 2/2 ceph: fix use-after-free bug

From: "Yan, Zheng" <[email protected]>

---
 fs/ceph/inode.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/inode.c +1 -0
index 6f0a35c..2ae1381 100644
@@ -779,6 +779,7 @@ no_change:
 			rb_node = rb_next(rb_node);
 			rb_erase(&frag->node, &ci->i_fragtree);
 			kfree(frag);
+			frag = NULL;
 		}
 		if (!frag) {
 			frag = __get_or_create_frag(ci, id);
Signature · 1 line
1.8.1.4
#2 lore raw
In reply to Yan, Zheng

Hi Yan,

I squashed these two patches into the commits they fix. master and testing branches are updated+rebased.

NOTE: I've been treating these branches as a patch queue and rebase as needed. If anyone is using the ceph-client.git tree as a basis for development and is disrupted by this, let me know!

sage

Quoted 30 lines · Zheng

From: "Yan, Zheng" <[email protected]>

---
 fs/ceph/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/inode.c +2 -1
index 49d4de0..6f0a35c 100644
@@ -1288,7 +1288,8 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
 	u64 r_readdir_offset = req->r_readdir_offset;
 	u32 frag = le32_to_cpu(rhead->args.readdir.frag);
 
-	if (le32_to_cpu(rinfo->dir_dir->frag) != frag) {
+	if (rinfo->dir_dir &&
+	    le32_to_cpu(rinfo->dir_dir->frag) != frag) {
 		dout("readdir_prepopulate got new frag %x -> %x\n",
 		     frag, le32_to_cpu(rinfo->dir_dir->frag));
 		frag = le32_to_cpu(rinfo->dir_dir->frag);
Signature · 6 lines
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html