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] [day] [month] [year] [list]
Date:   Sun, 18 Aug 2019 09:27:30 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Pan Bian <bianpan2016@....com>, Jens Axboe <axboe@...nel.dk>
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block/bio-integrity: fix mismatched alloc free

On 8/18/19 3:35 AM, Pan Bian wrote:
> The function kmalloc rather than mempool_alloc is called to allocate
> memory when the memory pool is unavailable. However, mempool_alloc is
> used to release the memory chunck in both cases when error occurs. This
> patch fixes the bug.
> 
> Signed-off-by: Pan Bian <bianpan2016@....com>
> ---
>   block/bio-integrity.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index fb95dbb..011dfc8 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -75,7 +75,10 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
>   
>   	return bip;
>   err:
> -	mempool_free(bip, &bs->bio_integrity_pool);
> +	if (!bs || !mempool_initialized(&bs->bio_integrity_pool))
> +		kfree(bip);
> +	else
> +		mempool_free(bip, &bs->bio_integrity_pool);
>   	return ERR_PTR(-ENOMEM);
>   }
>   EXPORT_SYMBOL(bio_integrity_alloc);
> 

Also for this patch, please add "Fixes:" and "Cc: stable" tags.

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ