RE: [PATCH 1/8] block: tidy up the bio full checks in bio_add_hw_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Christoph.

>@@ -1014,6 +1014,10 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio,
>                 if (bio_try_merge_hw_seg(q, bio, page, len, offset, same_page))
>                         return len;
> 
>+                if (bio->bi_vcnt >=
>+                    min(bio->bi_max_vecs, queue_max_segments(q)))
>+                        return 0;
>+
>                 /*
>                  * If the queue doesn't support SG gaps and adding this segment
>                  * would create a gap, disallow it.
>@@ -1023,12 +1027,6 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio,
>                         return 0;
>         }
> 
>-        if (bio_full(bio, len))
>-                return 0;
>-
>-        if (bio->bi_vcnt >= queue_max_segments(q))
>-                return 0;
>-
>         bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, offset);
>         bio->bi_vcnt++;
>         bio->bi_iter.bi_size += len;
>-- 
>2.39.2

If the wrong bi_max_vecs is set in bio_init(e.g. bi_max_vec = 0),
I think we need a code to defend against page_add.
If modified in this way, it may be added to bvec normally and
cause inconsistency in the information of bio.

Best Regards,
Jinyoung.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux