We allocate a dedupe hash into async_extent, but forget to free it.
Fix it by freeing the hash before freeing async_extent.

Reported-by: Wang Xiaoguang <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
---
 fs/btrfs/inode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 979811c..81b19193 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -751,6 +751,7 @@ retry:
                                                  WB_SYNC_ALL);
                        else if (ret)
                                unlock_page(async_cow->locked_page);
+                       kfree(hash);
                        kfree(async_extent);
                        cond_resched();
                        continue;
@@ -876,6 +877,7 @@ retry:
                        free_async_extent_pages(async_extent);
                }
                alloc_hint = ins.objectid + ins.offset;
+               kfree(hash);
                kfree(async_extent);
                cond_resched();
        }
@@ -892,6 +894,7 @@ out_free:
                                     PAGE_SET_WRITEBACK | PAGE_END_WRITEBACK |
                                     PAGE_SET_ERROR);
        free_async_extent_pages(async_extent);
+       kfree(hash);
        kfree(async_extent);
        goto again;
 }
-- 
2.7.3



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

Reply via email to