VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Ming Lei <ming.lei@redhat.com> 2021-02-02 23:54:10 +0800 committer: Jens Axboe <axboe@kernel.dk> 2021-02-02 08:57:56 -0700 commit: 8358c28a5d44bf0223a55a2334086c3707bb4185 parent: a42e0d70c517c88c52154bf74ec39092d897aaca
Commit Summary:
block: fix memory leak of bvec
Diffstat:
1 file changed, 1 insertion, 1 deletion
diff --git a/block/bio.c b/block/bio.c
index d4375619348c..757fee46cefc 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -482,8 +482,8 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs,
 		if (unlikely(!bvl))
 			goto err_free;
 
-		bio->bi_flags |= idx << BVEC_POOL_OFFSET;
 		bio_init(bio, bvl, bvec_nr_vecs(idx));
+		bio->bi_flags |= idx << BVEC_POOL_OFFSET;
 	} else if (nr_iovecs) {
 		bio_init(bio, bio->bi_inline_vecs, BIO_INLINE_VECS);
 	} else {