Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: song@kernel.org, axboe@kernel.dk
Cc: johannes.thumshirn@wdc.com, linux-raid@vger.kernel.org,
	linux-block@vger.kernel.org
Subject: [PATCH] raid1: fix incorrect page freeing in alloc_behind_master_bio
Date: Mon,  5 Jun 2023 09:21:14 +0200	[thread overview]
Message-ID: <20230605072114.497609-1-hch@lst.de> (raw)

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


             reply	other threads:[~2023-06-05  7:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  7:21 Christoph Hellwig [this message]
2023-06-05  7:58 ` [PATCH] raid1: fix incorrect page freeing in alloc_behind_master_bio Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230605072114.497609-1-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox