* [PATCH] raid1: fix incorrect page freeing in alloc_behind_master_bio
@ 2023-06-05 7:21 Christoph Hellwig
2023-06-05 7:58 ` Johannes Thumshirn
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2023-06-05 7:21 UTC (permalink / raw)
To: song, axboe; +Cc: johannes.thumshirn, linux-raid, linux-block
free_page takes the virtual address of the memory to be freed, and
does so as an unsigned long just to make things confusing. Use
put_page instead, which actually works on the page pointer.
Note that this is a reason why this should have used __bio_add_page
instead for this impossible to hit case..
Fixes: 2f9848178cfa ("md: raid1: use __bio_add_page for adding single page to bio")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/raid1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ff89839455ec11..3570da63969b58 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1148,7 +1148,7 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
goto free_pages;
if (!bio_add_page(behind_bio, page, len, 0)) {
- free_page(page);
+ put_page(page);
goto free_pages;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] raid1: fix incorrect page freeing in alloc_behind_master_bio
2023-06-05 7:21 [PATCH] raid1: fix incorrect page freeing in alloc_behind_master_bio Christoph Hellwig
@ 2023-06-05 7:58 ` Johannes Thumshirn
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2023-06-05 7:58 UTC (permalink / raw)
To: Christoph Hellwig, song@kernel.org, axboe@kernel.dk
Cc: linux-raid@vger.kernel.org, linux-block@vger.kernel.org
On 05.06.23 09:21, Christoph Hellwig wrote:
> free_page takes the virtual address of the memory to be freed, and
> does so as an unsigned long just to make things confusing. Use
> put_page instead, which actually works on the page pointer.
>
> Note that this is a reason why this should have used __bio_add_page
> instead for this impossible to hit case..
>
> Fixes: 2f9848178cfa ("md: raid1: use __bio_add_page for adding single page to bio")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/md/raid1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index ff89839455ec11..3570da63969b58 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1148,7 +1148,7 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
> goto free_pages;
>
> if (!bio_add_page(behind_bio, page, len, 0)) {
> - free_page(page);
> + put_page(page);
> goto free_pages;
> }
>
That should already be fixed in Jens' tree.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-05 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05 7:21 [PATCH] raid1: fix incorrect page freeing in alloc_behind_master_bio Christoph Hellwig
2023-06-05 7:58 ` Johannes Thumshirn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox