mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
block: avoid to READ fields of null bio
rq->bio can be NULL sometimes, such as flush request, so don't
read bio->bi_seg_front_size until this 'bio' is checked as valid.
Cc: Bart Van Assche <[email protected]>
Reported-by: Bart Van Assche <[email protected]>
Fixes: dcebd75592 ("block: use bio_for_each_bvec() to compute multi-page bvec count")
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
6fb845f0e7
commit
49b1f22b56
1 changed files with 3 additions and 1 deletions
|
|
@ -363,13 +363,15 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
|
|||
struct bio_vec bv, bvprv = { NULL };
|
||||
int prev = 0;
|
||||
unsigned int seg_size, nr_phys_segs;
|
||||
unsigned front_seg_size = bio->bi_seg_front_size;
|
||||
unsigned front_seg_size;
|
||||
struct bio *fbio, *bbio;
|
||||
struct bvec_iter iter;
|
||||
|
||||
if (!bio)
|
||||
return 0;
|
||||
|
||||
front_seg_size = bio->bi_seg_front_size;
|
||||
|
||||
switch (bio_op(bio)) {
|
||||
case REQ_OP_DISCARD:
|
||||
case REQ_OP_SECURE_ERASE:
|
||||
|
|
|
|||
Loading…
Reference in a new issue