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: <CAOQ4uxgUoPB4jOCro4nDs7wby_GN593iuh8QhD9cGwSQJZJxdQ@mail.gmail.com>
Date:   Tue, 12 Jun 2018 08:32:09 +0300
From:   Amir Goldstein <amir73il@...il.com>
To:     Zhouyang Jia <jiazhouyang09@...il.com>
Cc:     Jan Kara <jack@...e.cz>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fsnotify: add error handling for kmem_cache_create

On Tue, Jun 12, 2018 at 7:16 AM, Zhouyang Jia <jiazhouyang09@...il.com> wrote:
> When kmem_cache_create fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling kmem_cache_create.
>
> Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
> ---
>  fs/notify/dnotify/dnotify.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
> index 63a1ca4..216b411 100644
> --- a/fs/notify/dnotify/dnotify.c
> +++ b/fs/notify/dnotify/dnotify.c
> @@ -387,6 +387,9 @@ static int __init dnotify_init(void)
>         dnotify_struct_cache = KMEM_CACHE(dnotify_struct, SLAB_PANIC);
>         dnotify_mark_cache = KMEM_CACHE(dnotify_mark, SLAB_PANIC);
>
> +       if (!dnotify_struct_cache || !dnotify_mark_cache)
> +               return -ENOMEM;
> +

If only one failed need to free the other.

>         dnotify_group = fsnotify_alloc_group(&dnotify_fsnotify_ops);
>         if (IS_ERR(dnotify_group))
>                 panic("unable to allocate fsnotify group for dnotify\n");
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ