diff mbox

[1/3] Btrfs: fix memory patcher through fs_info->qgroup_ulist

Message ID 1369756044-17194-2-git-send-email-list.btrfs@jan-o-sch.net (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Jan Schmidt May 28, 2013, 3:47 p.m. UTC
Commit 5b7c665e introduced fs_info->qgroup_ulist, that is allocated during
btrfs_read_qgroup_config and meant to be used later by the qgroup accounting
code. However, it is always freed before btrfs_read_qgroup_config returns,
becuase the commit mentioned above adds a check for (ret), where a check
for (ret < 0) would have been the right choice. This commit fixes the check.

Cc: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
---
 fs/btrfs/qgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Wang Shilong May 29, 2013, 2:02 p.m. UTC | #1
Hello Jan

> Commit 5b7c665e introduced fs_info->qgroup_ulist, that is allocated during
> btrfs_read_qgroup_config and meant to be used later by the qgroup accounting
> code. However, it is always freed before btrfs_read_qgroup_config returns,
> becuase the commit mentioned above adds a check for (ret), where a check
> for (ret < 0) would have been the right choice. This commit fixes the check.
> 
> Cc: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
> ---
> fs/btrfs/qgroup.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index d059d86..74b432d 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -430,7 +430,7 @@ out:
> 	}
> 	btrfs_free_path(path);
> 
> -	if (ret)
> +	if (ret < 0)
> 		ulist_free(fs_info->qgroup_ulist);
> 

Looks good to me ,thanks very much for fixing this issue!

Thanks,
Wang

> 	return ret < 0 ? ret : 0;
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index d059d86..74b432d 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -430,7 +430,7 @@  out:
 	}
 	btrfs_free_path(path);
 
-	if (ret)
+	if (ret < 0)
 		ulist_free(fs_info->qgroup_ulist);
 
 	return ret < 0 ? ret : 0;