lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140529070430.GA2602@dhcp-27-189.brq.redhat.com>
Date:	Thu, 29 May 2014 09:04:31 +0200
From:	Maurizio Lombardi <mlombard@...hat.com>
To:	Jet Chen <jet.chen@...el.com>
Cc:	Ming Lei <tom.leiming@...il.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Jens Axboe <axboe@...nel.dk>,
	Dongsu Park <dongsu.park@...fitbricks.com>,
	Fengguang Wu <fengguang.wu@...el.com>
Subject: Re: [PATCH] bio: decrease bi_iter.bi_size by len in the fail path

On Thu, May 29, 2014 at 02:06:18PM +0800, Jet Chen wrote:
> This patch works, thanks.
> 
> Tested-by: Jet Chen <jet.chen@...el.com>
> 

> diff --git a/block/bio.c b/block/bio.c
> index 0443694..f9bae56 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -744,6 +744,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
>  				}
>  			}
>  
> +			bio->bi_iter.bi_size += len;
>  			goto done;
>  		}
>  	}
> @@ -761,6 +762,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
>  	bvec->bv_offset = offset;
>  	bio->bi_vcnt++;
>  	bio->bi_phys_segments++;
> +	bio->bi_iter.bi_size += len;
>  
>  	/*
>  	 * Perform a recount if the number of segments is greater
> @@ -802,7 +804,6 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
>  		bio->bi_flags &= ~(1 << BIO_SEG_VALID);
>  
>   done:
> -	bio->bi_iter.bi_size += len;
>  	return len;
>  
>   failed:
> @@ -810,6 +811,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
>  	bvec->bv_len = 0;
>  	bvec->bv_offset = 0;
>  	bio->bi_vcnt--;
> +	bio->bi_iter.bi_size -= len;
>  	blk_recount_segments(q, bio);
>  	return 0;
>  }

Good!

Jens, can you review and merge it?

Thanks,
Maurizio Lombardi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ