Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix wrong list access on the failure of reading out checksum
@ 2014-12-01 10:04 Miao Xie
  2014-12-01 10:53 ` Miao Xie
  0 siblings, 1 reply; 2+ messages in thread
From: Miao Xie @ 2014-12-01 10:04 UTC (permalink / raw)
  To: linux-btrfs

If we failed to reading out the checksum, we would free all the checksums
in the list. But the current code accessed the list head, not the entry
in the list. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/file-item.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 783a943..c26b58f 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -413,7 +413,8 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
 	ret = 0;
 fail:
 	while (ret < 0 && !list_empty(&tmplist)) {
-		sums = list_entry(&tmplist, struct btrfs_ordered_sum, list);
+		sums = list_first_entry(&tmplist, struct btrfs_ordered_sum,
+					list);
 		list_del(&sums->list);
 		kfree(sums);
 	}
-- 
1.9.3


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

* Re: [PATCH] Btrfs: fix wrong list access on the failure of reading out checksum
  2014-12-01 10:04 [PATCH] Btrfs: fix wrong list access on the failure of reading out checksum Miao Xie
@ 2014-12-01 10:53 ` Miao Xie
  0 siblings, 0 replies; 2+ messages in thread
From: Miao Xie @ 2014-12-01 10:53 UTC (permalink / raw)
  To: linux-btrfs

Please ignore this patch, Chris has fixed this problem.

Thanks
Miao

On Mon, 1 Dec 2014 18:04:13 +0800, Miao Xie wrote:
> If we failed to reading out the checksum, we would free all the checksums
> in the list. But the current code accessed the list head, not the entry
> in the list. Fix it.
> 
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
>  fs/btrfs/file-item.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
> index 783a943..c26b58f 100644
> --- a/fs/btrfs/file-item.c
> +++ b/fs/btrfs/file-item.c
> @@ -413,7 +413,8 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
>  	ret = 0;
>  fail:
>  	while (ret < 0 && !list_empty(&tmplist)) {
> -		sums = list_entry(&tmplist, struct btrfs_ordered_sum, list);
> +		sums = list_first_entry(&tmplist, struct btrfs_ordered_sum,
> +					list);
>  		list_del(&sums->list);
>  		kfree(sums);
>  	}
> 


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

end of thread, other threads:[~2014-12-01 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-01 10:04 [PATCH] Btrfs: fix wrong list access on the failure of reading out checksum Miao Xie
2014-12-01 10:53 ` Miao Xie

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