[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <71B1FB5B-DB3A-4E23-A62B-3ACC63D83319@umn.edu>
Date: Fri, 22 Mar 2019 21:20:31 -0500
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Oded Gabbay <oded.gabbay@...il.com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"David (ChunMing) Zhou" <David1.Zhou@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpu: amdkfd: fix a missing check of kmemdup
> On Mar 8, 2019, at 10:19 PM, Kangjie Lu <kjlu@....edu> wrote:
>
> kmemdup could fail and return NULL. To avoid null pointer
> dereference, the fix checkes its return value and returns
> ENOMEM upon failures.
This is a NULL-pointer dereference issue.
Can someone review this patch? Thanks.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> index 2e7c44955f43..7ef62d4e7598 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> @@ -404,6 +404,9 @@ static int kfd_parse_subtype_iolink(struct crat_subtype_iolink *iolink,
> return -ENODEV;
> /* same everything but the other direction */
> props2 = kmemdup(props, sizeof(*props2), GFP_KERNEL);
> + if (!props2)
> + return -ENOMEM;
> +
> props2->node_from = id_to;
> props2->node_to = id_from;
> props2->kobj = NULL;
> --
> 2.17.1
>
Powered by blists - more mailing lists