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: <24bb310e-6ce2-88c9-ebdc-59d49c609d77@suse.de>
Date:   Thu, 7 Apr 2022 16:16:31 +0800
From:   Coly Li <colyli@...e.de>
To:     Christoph Hellwig <hch@....de>
Cc:     Mike Snitzer <snitzer@...hat.com>, Song Liu <song@...nel.org>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Josef Bacik <josef@...icpanda.com>,
        Jens Axboe <axboe@...nel.dk>, David Sterba <dsterba@...e.com>,
        Phillip Lougher <phillip@...ashfs.org.uk>,
        linux-block@...r.kernel.org, dm-devel@...hat.com,
        linux-kernel@...r.kernel.org, linux-bcache@...r.kernel.org,
        linux-raid@...r.kernel.org, target-devel@...r.kernel.org,
        linux-btrfs@...r.kernel.org
Subject: Re: [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper

On 4/6/22 2:12 PM, Christoph Hellwig wrote:
> Remove the magic autofree semantics and require the callers to explicitly
> call bio_init to initialize the bio.
>
> This allows bio_free to catch accidental bio_put calls on bio_init()ed
> bios as well.
>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
>   block/bio.c                        | 47 ++++++++++++------------------
>   block/blk-crypto-fallback.c        | 14 +++++----
>   block/blk-map.c                    | 42 ++++++++++++++++----------
>   drivers/block/pktcdvd.c            | 25 ++++++++--------
>   drivers/md/bcache/debug.c          | 10 ++++---
>   drivers/md/dm-bufio.c              |  9 +++---
>   drivers/md/raid1.c                 | 12 +++++---
>   drivers/md/raid10.c                | 21 ++++++++-----
>   drivers/target/target_core_pscsi.c | 10 +++----
>   fs/squashfs/block.c                | 15 +++++-----
>   include/linux/bio.h                |  2 +-
>   11 files changed, 112 insertions(+), 95 deletions(-)
[snipped]
> diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
> index 6230dfdd9286e..7510d1c983a5e 100644
> --- a/drivers/md/bcache/debug.c
> +++ b/drivers/md/bcache/debug.c
> @@ -107,15 +107,16 @@ void bch_btree_verify(struct btree *b)
>   
>   void bch_data_verify(struct cached_dev *dc, struct bio *bio)
>   {
> +	unsigned int nr_segs = bio_segments(bio);
>   	struct bio *check;
>   	struct bio_vec bv, cbv;
>   	struct bvec_iter iter, citer = { 0 };
>   
> -	check = bio_kmalloc(GFP_NOIO, bio_segments(bio));
> +	check = bio_kmalloc(nr_segs, GFP_NOIO);
>   	if (!check)
>   		return;
> -	bio_set_dev(check, bio->bi_bdev);
> -	check->bi_opf = REQ_OP_READ;
> +	bio_init(check, bio->bi_bdev, check->bi_inline_vecs, nr_segs,
> +		 REQ_OP_READ);
>   	check->bi_iter.bi_sector = bio->bi_iter.bi_sector;
>   	check->bi_iter.bi_size = bio->bi_iter.bi_size;
>   
> @@ -146,7 +147,8 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
>   
>   	bio_free_pages(check);
>   out_put:
> -	bio_put(check);
> +	bio_uninit(check);
> +	kfree(check);
>   }
>   
>   #endif

[snipped]

For bcache part,

Acked-by: Coly Li <colyli@...e.de>


Coly Li



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ