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: <9b98c931-0740-8bfc-f815-a06018ad5547@gmx.com>
Date:   Tue, 25 Oct 2022 17:47:53 +0800
From:   Qu Wenruo <quwenruo.btrfs@....com>
To:     Li zeming <zeming@...china.com>, clm@...com, josef@...icpanda.com,
        dsterba@...e.com
Cc:     linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: volumes: Increase bioc pointer check



On 2022/10/25 16:28, Li zeming wrote:
> If kzalloc fails to allocate the bioc pointer, NULL is returned
> directly.

s/is returned/should be returned/

>
> Signed-off-by: Li zeming <zeming@...china.com>
> ---
>   fs/btrfs/volumes.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 064ab2a79c80..f9cb815fe23d 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5892,6 +5892,8 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_
>   		 */
>   		sizeof(u64) * (total_stripes),
>   		GFP_NOFS|__GFP_NOFAIL);

I think you can also remove the __GFP_NOFAIL flag.

Especially the only caller is properly handling the error.

With that __GFP_NOFAIL flag there, it should not fail, but we can not
just rely on NOFAIL flag to save our asses.

Otherwise looks good to me.

With above two points fixed, you can add my tag:

Reviewed-by: Qu Wenruo <wqu@...e.com>

Thanks,
Qu

> +	if (!bioc)
> +		return NULL;
>
>   	atomic_set(&bioc->error, 0);
>   	refcount_set(&bioc->refs, 1);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ