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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yd52ziCZh7aJUTIU@sol.localdomain>
Date:   Tue, 11 Jan 2022 22:35:58 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc:     viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/eventfd.c: Check error number after calling
 ida_simple_get

On Tue, Jan 11, 2022 at 03:00:23PM +0800, Jiasheng Jiang wrote:
> As the possible failure of the allocation, the ida_simple_get() will
> return error number.
> And then ctx->id will be printed in eventfd_show_fdinfo().
> Therefore, it should be better to check it and return error if fails,
> like the other allocation.
> 
> Fixes: b556db17b0e7 ("eventfd: present id to userspace via fdinfo")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
>  fs/eventfd.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/eventfd.c b/fs/eventfd.c
> index 3627dd7d25db..5ec1d998f3ac 100644
> --- a/fs/eventfd.c
> +++ b/fs/eventfd.c
> @@ -424,6 +424,10 @@ static int do_eventfd(unsigned int count, int flags)
>  	ctx->count = count;
>  	ctx->flags = flags;
>  	ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
> +	if (ctx->id) {
> +		fd = ctx->id;
> +		goto err;
> +	}

Shouldn't this be 'ctx->id < 0'?

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ