[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241228021543.216542-1-wdhh66@163.com>
Date: Sat, 28 Dec 2024 10:15:43 +0800
From: Chaohai Chen <wdhh66@....com>
To: song@...nel.org
Cc: yukuai3@...wei.com,
linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chaohai Chen <wdhh66@....com>
Subject: [PATCH] md: fix NULL point access
bio_alloc_bioset may return NULL, we need to judge it before
assign value to members of "new".
Signed-off-by: Chaohai Chen <wdhh66@....com>
---
drivers/md/md.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index aebe12b0ee27..a23419ad3dd8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -585,6 +585,8 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio)
new = bio_alloc_bioset(rdev->bdev, 0,
REQ_OP_WRITE | REQ_PREFLUSH, GFP_NOIO,
&mddev->bio_set);
+ if (!new)
+ continue;
new->bi_private = bio;
new->bi_end_io = md_end_flush;
bio_inc_remaining(bio);
--
2.34.1
Powered by blists - more mailing lists