Whamcloud - gitweb
LU-15668 osd-ldiskfs: fix osd_bio_private double free 79/46879/5
authorLi Dongyang <dongyangli@ddn.com>
Tue, 22 Mar 2022 01:12:23 +0000 (12:12 +1100)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 May 2023 19:11:34 +0000 (19:11 +0000)
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().

Test-Parameters: trivial
Change-Id: I42eaf95a85ec99a60359122054efb5beb0fb6104
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46879
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/osd-ldiskfs/osd_io.c

index 43bc85c..40d6a00 100644 (file)
@@ -612,6 +612,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 = cfs_bio_alloc(bdev,
                                            min_t(unsigned short, BIO_MAX_VECS,
                                                  (block_idx_end - block_idx +