* [PATCH] gpu: amdkfd: fix a missing check of kmemdup
@ 2019-03-09 4:19 Kangjie Lu
2019-03-23 2:20 ` Kangjie Lu
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-09 4:19 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Oded Gabbay, Alex Deucher, Christian König,
David (ChunMing) Zhou, David Airlie, Daniel Vetter, dri-devel,
amd-gfx, linux-kernel
kmemdup could fail and return NULL. To avoid null pointer
dereference, the fix checkes its return value and returns
ENOMEM upon failures.
Signed-off-by: Kangjie Lu <kjlu@umn.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpu: amdkfd: fix a missing check of kmemdup
2019-03-09 4:19 [PATCH] gpu: amdkfd: fix a missing check of kmemdup Kangjie Lu
@ 2019-03-23 2:20 ` Kangjie Lu
0 siblings, 0 replies; 2+ messages in thread
From: Kangjie Lu @ 2019-03-23 2:20 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Oded Gabbay, Alex Deucher, Christian König,
David (ChunMing) Zhou, David Airlie, Daniel Vetter, dri-devel,
amd-gfx, linux-kernel
> On Mar 8, 2019, at 10:19 PM, Kangjie Lu <kjlu@umn.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@umn.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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-23 2:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 4:19 [PATCH] gpu: amdkfd: fix a missing check of kmemdup Kangjie Lu
2019-03-23 2:20 ` Kangjie Lu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.