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:   Thu, 24 Mar 2022 15:51:09 -0400
From:   Alex Deucher <alexdeucher@...il.com>
To:     QintaoShen <unSimple1993@....com>
Cc:     "Kuehling, Felix" <Felix.Kuehling@....com>,
        LKML <linux-kernel@...r.kernel.org>,
        amd-gfx list <amd-gfx@...ts.freedesktop.org>
Subject: Re: [PATCH v1] drm/amdkfd: Check for potential null return of kmalloc_array()

Applied.  Thanks!

Alex

On Thu, Mar 24, 2022 at 9:46 AM QintaoShen <unSimple1993@....com> wrote:
>
> As the kmalloc_array() may return null, the 'event_waiters[i].wait' would lead to null-pointer dereference.
> Therefore, it is better to check the return value of kmalloc_array() to avoid this confusion.
>
> Signed-off-by: QintaoShen <unSimple1993@....com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> index deeccce..64f4a51 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> @@ -749,6 +749,8 @@ static struct kfd_event_waiter *alloc_event_waiters(uint32_t num_events)
>         event_waiters = kmalloc_array(num_events,
>                                         sizeof(struct kfd_event_waiter),
>                                         GFP_KERNEL);
> +       if (!event_waiters)
> +               return NULL;
>
>         for (i = 0; (event_waiters) && (i < num_events) ; i++) {
>                 init_wait(&event_waiters[i].wait);
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ