All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: fix possible double free in ocfs2_reflink_xattr_rec
@ 2013-08-02  7:30 Joseph Qi
  2013-08-06 14:43 ` Jeff Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Qi @ 2013-08-02  7:30 UTC (permalink / raw)
  To: ocfs2-devel

In ocfs2_reflink_xattr_rec(), meta_ac and data_ac are allocated by
calling ocfs2_lock_reflink_xattr_rec_allocators().
Once an error occurs when allocating *data_ac, it frees *meta_ac which
is allocated before. Here it mistakenly sets meta_ac to NULL but
*meta_ac. Then ocfs2_reflink_xattr_rec() will try to free meta_ac again
which is already invalid.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
---
 fs/ocfs2/xattr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 87daa44..bd2a1f0 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -6799,7 +6799,7 @@ out:
 	if (ret) {
 		if (*meta_ac) {
 			ocfs2_free_alloc_context(*meta_ac);
-			meta_ac = NULL;
+			*meta_ac = NULL;
 		}
 	}

-- 
1.7.9.7

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

* [Ocfs2-devel] [PATCH] ocfs2: fix possible double free in ocfs2_reflink_xattr_rec
  2013-08-02  7:30 [Ocfs2-devel] [PATCH] ocfs2: fix possible double free in ocfs2_reflink_xattr_rec Joseph Qi
@ 2013-08-06 14:43 ` Jeff Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Liu @ 2013-08-06 14:43 UTC (permalink / raw)
  To: ocfs2-devel

On 08/02/2013 03:30 PM, Joseph Qi wrote:

> In ocfs2_reflink_xattr_rec(), meta_ac and data_ac are allocated by
> calling ocfs2_lock_reflink_xattr_rec_allocators().
> Once an error occurs when allocating *data_ac, it frees *meta_ac which
> is allocated before. Here it mistakenly sets meta_ac to NULL but
> *meta_ac. Then ocfs2_reflink_xattr_rec() will try to free meta_ac again
> which is already invalid.
> 
> Signed-off-by: Joseph Qi <joseph.qi@huawei.com>

Looks good to me, thanks.

Reviewed-by: Jie Liu <jeff.liu@oracle.com>

> ---
>  fs/ocfs2/xattr.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 87daa44..bd2a1f0 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -6799,7 +6799,7 @@ out:
>  	if (ret) {
>  		if (*meta_ac) {
>  			ocfs2_free_alloc_context(*meta_ac);
> -			meta_ac = NULL;
> +			*meta_ac = NULL;
>  		}
>  	}
> 

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-02  7:30 [Ocfs2-devel] [PATCH] ocfs2: fix possible double free in ocfs2_reflink_xattr_rec Joseph Qi
2013-08-06 14:43 ` Jeff Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.