linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Fix null dereference in relocation.c
@ 2010-05-31  8:58 Yan, Zheng
  2010-05-31 10:05 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Yan, Zheng @ 2010-05-31  8:58 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Chris Mason, error27

Fix a potential null dereference in relocation.c

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>

---
diff -urp 1/fs/btrfs/relocation.c 2/fs/btrfs/relocation.c
--- 1/fs/btrfs/relocation.c	2010-05-26 00:13:07.227605825 +0800
+++ 2/fs/btrfs/relocation.c	2010-05-31 16:35:23.489829633 +0800
@@ -784,16 +784,17 @@ again:
 				struct btrfs_extent_ref_v0 *ref0;
 				ref0 = btrfs_item_ptr(eb, path1->slots[0],
 						struct btrfs_extent_ref_v0);
-				root = find_tree_root(rc, eb, ref0);
-				if (!root->ref_cows)
-					cur->cowonly = 1;
 				if (key.objectid == key.offset) {
+					root = find_tree_root(rc, eb, ref0);
 					if (root && !should_ignore_root(root))
 						cur->root = root;
 					else
 						list_add(&cur->list, &useless);
 					break;
 				}
+				if (is_cowonly_root(btrfs_ref_root_v0(eb,
+								      ref0)))
+					cur->cowonly = 1;
 			}
 #else
 		BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY);

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

* Re: [PATCH] btrfs: Fix null dereference in relocation.c
  2010-05-31  8:58 [PATCH] btrfs: Fix null dereference in relocation.c Yan, Zheng
@ 2010-05-31 10:05 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2010-05-31 10:05 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: linux-btrfs, Chris Mason

On Mon, May 31, 2010 at 04:58:47PM +0800, Yan, Zheng wrote:
> Fix a potential null dereference in relocation.c
> 

Thanks for that.

Acked-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter



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

end of thread, other threads:[~2010-05-31 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-31  8:58 [PATCH] btrfs: Fix null dereference in relocation.c Yan, Zheng
2010-05-31 10:05 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).