mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 5.4 0/1] drm/amdkfd: Check for null pointer after calling kmemdup
@ 2023-01-04 17:51 Dragos-Marian Panait
  2023-01-04 17:51 ` [PATCH 5.4 1/1] " Dragos-Marian Panait
  0 siblings, 1 reply; 2+ messages in thread
From: Dragos-Marian Panait @ 2023-01-04 17:51 UTC (permalink / raw)
  To: stable
  Cc: Jiasheng Jiang, Felix Kuehling, Alex Deucher, Oded Gabbay,
	Christian König, David Airlie, Daniel Vetter, Kent Russell,
	Harish Kasiviswanathan, Ben Goz, dri-devel, amd-gfx,
	linux-kernel

The following commit is needed to fix CVE-2022-3108:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abfaf0eee97925905e742aa3b0b72e04a918fa9e

Jiasheng Jiang (1):
  drm/amdkfd: Check for null pointer after calling kmemdup

 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++
 1 file changed, 3 insertions(+)


base-commit: 851c2b5fb7936d54e1147f76f88e2675f9f82b52
-- 
2.38.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 5.4 1/1] drm/amdkfd: Check for null pointer after calling kmemdup
  2023-01-04 17:51 [PATCH 5.4 0/1] drm/amdkfd: Check for null pointer after calling kmemdup Dragos-Marian Panait
@ 2023-01-04 17:51 ` Dragos-Marian Panait
  0 siblings, 0 replies; 2+ messages in thread
From: Dragos-Marian Panait @ 2023-01-04 17:51 UTC (permalink / raw)
  To: stable
  Cc: Jiasheng Jiang, Felix Kuehling, Alex Deucher, Oded Gabbay,
	Christian König, David Airlie, Daniel Vetter, Kent Russell,
	Harish Kasiviswanathan, Ben Goz, dri-devel, amd-gfx,
	linux-kernel

From: Jiasheng Jiang <jiasheng@iscas.ac.cn>

[ Upstream commit abfaf0eee97925905e742aa3b0b72e04a918fa9e ]

As the possible failure of the allocation, kmemdup() may return NULL
pointer.
Therefore, it should be better to check the 'props2' in order to prevent
the dereference of NULL pointer.

Fixes: 3a87177eb141 ("drm/amdkfd: Add topology support for dGPUs")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dragos-Marian Panait <dragos.panait@windriver.com>
---
 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 3685e89415d5..6066cd7a9d8c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -407,6 +407,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.38.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-04 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 17:51 [PATCH 5.4 0/1] drm/amdkfd: Check for null pointer after calling kmemdup Dragos-Marian Panait
2023-01-04 17:51 ` [PATCH 5.4 1/1] " Dragos-Marian Panait

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®