drm/amdkfd: Check for null pointer after calling kmemdup
cover drm/amdkfd: Check for null pointer after calling kmemdup
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: c652c812211c7a427d16be1d3f904eb02eb4265f
Signature · 1 line
2.38.1
PATCH 1/1 drm/amdkfd: Check for null pointer after calling kmemdup
From: Jiasheng Jiang <[email protected]>
[ 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.
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +3 -0
@@ -397,6 +397,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 ;
Signature · 1 line
2.38.1
Greg KH
maintainerQuoted 15 lines · Dragos-Marian Panait
From: Jiasheng Jiang <[email protected]>
[ 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 <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Dragos-Marian Panait <[email protected]>
Quoted 3 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)
For obvious reasons, I can't take a patch for 4.19.y and not newer kernel releases, right?
Please provide backports for all kernels if you really need to see this merged. And note, it's not a real bug at all, and given that a CVE was allocated for it that makes me want to even more reject it to show the whole folly of that mess.
thanks,
greg k-h
Am 04.01.23 um 13:41 schrieb Greg KH:
Quoted 19 lines · Dragos-Marian Panait
Quoted 15 lines
From: Jiasheng Jiang <[email protected]>
[ 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 <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Dragos-Marian Panait <[email protected]>Quoted 3 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 7 lines
For obvious reasons, I can't take a patch for 4.19.y and not newer kernel releases, right?
Please provide backports for all kernels if you really need to see this merged. And note, it's not a real bug at all, and given that a CVE was allocated for it that makes me want to even more reject it to show the whole folly of that mess.
Well as far as I can see this is nonsense to back port.
The code in question is only used only once during driver load and then never again, that exactly this allocation fails while tons of other are made before and after is extremely unlikely.
It's nice to have it fixed in newer kernels, but not worth a backport and certainly not stuff for a CVE.
Regards,
Christian.
Quoted 4 lines
thanks,
greg k-h
Quoted 29 lines · Christian König
Am 04.01.23 um 13:41 schrieb Greg KH:
Quoted 19 lines · Dragos-Marian Panait
Quoted 15 lines
From: Jiasheng Jiang <[email protected]>
[ 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 <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Dragos-Marian Panait <[email protected]>Quoted 3 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 7 lines
For obvious reasons, I can't take a patch for 4.19.y and not newer kernel releases, right?
Please provide backports for all kernels if you really need to see this merged. And note, it's not a real bug at all, and given that a CVE was allocated for it that makes me want to even more reject it to show the whole folly of that mess.
Quoted 8 lines
Well as far as I can see this is nonsense to back port.
The code in question is only used only once during driver load and then never again, that exactly this allocation fails while tons of other are made before and after is extremely unlikely.
It's nice to have it fixed in newer kernels, but not worth a backport and certainly not stuff for a CVE.
It's already fixed in Linus' tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abfaf0eee97925905e742aa3b0b72e04a918fa9e
Alex
Quoted 10 lines
Regards,
Christian.Quoted 4 lines
thanks,
greg k-h
Greg KH
maintainerQuoted 36 lines · Alex Deucher
Quoted 35 lines · Christian König
Am 04.01.23 um 13:41 schrieb Greg KH:
Quoted 19 lines · Dragos-Marian Panait
Quoted 15 lines
From: Jiasheng Jiang <[email protected]>
[ 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 <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Dragos-Marian Panait <[email protected]>Quoted 3 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 7 lines
For obvious reasons, I can't take a patch for 4.19.y and not newer kernel releases, right?
Please provide backports for all kernels if you really need to see this merged. And note, it's not a real bug at all, and given that a CVE was allocated for it that makes me want to even more reject it to show the whole folly of that mess.
Well as far as I can see this is nonsense to back port.
The code in question is only used only once during driver load and then never again, that exactly this allocation fails while tons of other are made before and after is extremely unlikely.
Quoted 5 lines
Quoted 2 lines
It's nice to have it fixed in newer kernels, but not worth a backport and certainly not stuff for a CVE.
It's already fixed in Linus' tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abfaf0eee97925905e742aa3b0b72e04a918fa9e
Yes, that's what the above commit shows...
confused,
greg k-h
Quoted 37 lines · Greg KH
Quoted 36 lines · Alex Deucher
Quoted 35 lines · Christian König
Am 04.01.23 um 13:41 schrieb Greg KH:
Quoted 19 lines · Dragos-Marian Panait
Quoted 15 lines
From: Jiasheng Jiang <[email protected]>
[ 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 <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Dragos-Marian Panait <[email protected]>Quoted 3 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 7 lines
For obvious reasons, I can't take a patch for 4.19.y and not newer kernel releases, right?
Please provide backports for all kernels if you really need to see this merged. And note, it's not a real bug at all, and given that a CVE was allocated for it that makes me want to even more reject it to show the whole folly of that mess.
Well as far as I can see this is nonsense to back port.
The code in question is only used only once during driver load and then never again, that exactly this allocation fails while tons of other are made before and after is extremely unlikely.
It's nice to have it fixed in newer kernels, but not worth a backport and certainly not stuff for a CVE.
Quoted 7 lines
Quoted 2 lines
It's already fixed in Linus' tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abfaf0eee97925905e742aa3b0b72e04a918fa9eYes, that's what the above commit shows...
confused,
greg k-h
Just for completeness, I also sent out patches for 5.4 and 5.10 stable branches.
5.15 stable branch already has this change: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=5609b7803947eea1711516dd8659c7ed39f5a868
Dragos
Greg KH
maintainerQuoted 41 lines · Dragos-Marian Panait
Quoted 39 lines · Greg KH
Quoted 38 lines · Alex Deucher
Quoted 27 lines · Christian König
Am 04.01.23 um 13:41 schrieb Greg KH:
Quoted 19 lines · Dragos-Marian Panait
Quoted 15 lines
From: Jiasheng Jiang <[email protected]>
[ 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 <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Dragos-Marian Panait <[email protected]>Quoted 3 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 7 lines
For obvious reasons, I can't take a patch for 4.19.y and not newer kernel releases, right?
Please provide backports for all kernels if you really need to see this merged. And note, it's not a real bug at all, and given that a CVE was allocated for it that makes me want to even more reject it to show the whole folly of that mess.
Quoted 8 lines
Well as far as I can see this is nonsense to back port.
The code in question is only used only once during driver load and then never again, that exactly this allocation fails while tons of other are made before and after is extremely unlikely.
It's nice to have it fixed in newer kernels, but not worth a backport and certainly not stuff for a CVE.
It's already fixed in Linus' tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abfaf0eee97925905e742aa3b0b72e04a918fa9e
Quoted 8 lines
Quoted 5 lines
Yes, that's what the above commit shows...
confused,
greg k-h
Just for completeness, I also sent out patches for 5.4 and 5.10 stable
branches.
5.15 stable branch already has this change: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=5609b7803947eea1711516dd8659c7ed39f5a868
Again, this is not a real bug and someone needs to go and invalidate that CVE so you don't have to worry about it anymore. I suggest that you do that if your company cares about tracking CVEs.
thanks,
greg k-h
Greg KH
maintainerQuoted 1 line · Dragos-Marian Panait
The following commit is needed to fix CVE-2022-3108:
That's a funny cve, given that you can not ever trigger it in a system, right? Why was a CVE allocated for that?
{sigh}