public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap
@ 2026-01-30 17:14 fdmanana
  2026-01-30 20:38 ` Qu Wenruo
  2026-02-02  6:24 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2026-01-30 17:14 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

We allocate the bitmap but we never free it in free_raid_bio_pointers().
Fix this by adding a bitmap_free() call against the stripe_uptodate_bitmap
of a raid bio.

Fixes: 1810350b04ef ("btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmap")
Reported-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/linux-btrfs/20260126045315.GA31641@lst.de/
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/raid56.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index f38d8305e46d..baadaaa189c0 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -150,6 +150,7 @@ static void scrub_rbio_work_locked(struct work_struct *work);
 static void free_raid_bio_pointers(struct btrfs_raid_bio *rbio)
 {
 	bitmap_free(rbio->error_bitmap);
+	bitmap_free(rbio->stripe_uptodate_bitmap);
 	kfree(rbio->stripe_pages);
 	kfree(rbio->bio_paddrs);
 	kfree(rbio->stripe_paddrs);
-- 
2.47.2


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

* Re: [PATCH] btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap
  2026-01-30 17:14 [PATCH] btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap fdmanana
@ 2026-01-30 20:38 ` Qu Wenruo
  2026-02-02  6:24 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2026-01-30 20:38 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



在 2026/1/31 03:44, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
> 
> We allocate the bitmap but we never free it in free_raid_bio_pointers().
> Fix this by adding a bitmap_free() call against the stripe_uptodate_bitmap
> of a raid bio.
> 
> Fixes: 1810350b04ef ("btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmap")
> Reported-by: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/linux-btrfs/20260126045315.GA31641@lst.de/
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

My bad, thank for pinning this down.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/raid56.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index f38d8305e46d..baadaaa189c0 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -150,6 +150,7 @@ static void scrub_rbio_work_locked(struct work_struct *work);
>   static void free_raid_bio_pointers(struct btrfs_raid_bio *rbio)
>   {
>   	bitmap_free(rbio->error_bitmap);
> +	bitmap_free(rbio->stripe_uptodate_bitmap);
>   	kfree(rbio->stripe_pages);
>   	kfree(rbio->bio_paddrs);
>   	kfree(rbio->stripe_paddrs);


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

* Re: [PATCH] btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap
  2026-01-30 17:14 [PATCH] btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap fdmanana
  2026-01-30 20:38 ` Qu Wenruo
@ 2026-02-02  6:24 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-02-02  6:24 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Fri, Jan 30, 2026 at 05:14:59PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> We allocate the bitmap but we never free it in free_raid_bio_pointers().
> Fix this by adding a bitmap_free() call against the stripe_uptodate_bitmap
> of a raid bio.
> 
> Fixes: 1810350b04ef ("btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmap")
> Reported-by: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/linux-btrfs/20260126045315.GA31641@lst.de/
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

This works there, thanks!

Tested-by: Christoph Hellwig <hch@lst.de>

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

end of thread, other threads:[~2026-02-02  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 17:14 [PATCH] btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap fdmanana
2026-01-30 20:38 ` Qu Wenruo
2026-02-02  6:24 ` Christoph Hellwig

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