From 3d4be4162b3d087b2ba3bf3200615e47f165d1c1 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Tue, 22 Mar 2022 12:12:23 +1100 Subject: [PATCH] LU-15668 osd-ldiskfs: fix osd_bio_private double free In osd_do_bio(), if the IO is fragmented and bio_alloc() fails to allocate new bio, the bio_private still holds osd_bio_private for last bio and will be double freed in osd_do_bio() and dio_integrity_complete_routine(). Lustre-change: https://review.whamcloud.com/46879 Lustre-commit: 82d44b71f16bea216e04f7797ed032a783301d66 Test-Parameters: trivial Change-Id: I42eaf95a85ec99a60359122054efb5beb0fb6104 Signed-off-by: Li Dongyang Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51187 Tested-by: jenkins Tested-by: Maloo --- lustre/osd-ldiskfs/osd_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 39ec7cb..d6e2a1f 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -589,6 +589,7 @@ static int osd_do_bio(struct osd_device *osd, struct inode *inode, bio_start_page_idx = page_idx; /* allocate new bio */ + bio_private = NULL; bio = bio_alloc(GFP_NOIO, min(BIO_MAX_PAGES, (block_idx_end - block_idx + blocks_left_page - 1))); -- 1.8.3.1