From c8450255f0c4c9cdd36f4ee757219f7fcb5a76f6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 13 Apr 2024 07:55:09 +0200 Subject: [PATCH] 5.15-stable patches added patches: amdkfd-use-calloc-instead-of-kzalloc-to-avoid-integer-overflow.patch --- ...of-kzalloc-to-avoid-integer-overflow.patch | 32 +++++++++++++++++++ queue-5.15/series | 1 + 2 files changed, 33 insertions(+) create mode 100644 queue-5.15/amdkfd-use-calloc-instead-of-kzalloc-to-avoid-integer-overflow.patch diff --git a/queue-5.15/amdkfd-use-calloc-instead-of-kzalloc-to-avoid-integer-overflow.patch b/queue-5.15/amdkfd-use-calloc-instead-of-kzalloc-to-avoid-integer-overflow.patch new file mode 100644 index 00000000000..cffb4f3ade3 --- /dev/null +++ b/queue-5.15/amdkfd-use-calloc-instead-of-kzalloc-to-avoid-integer-overflow.patch @@ -0,0 +1,32 @@ +From 3b0daecfeac0103aba8b293df07a0cbaf8b43f29 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 12 Apr 2024 06:11:25 +1000 +Subject: amdkfd: use calloc instead of kzalloc to avoid integer overflow + +From: Dave Airlie + +commit 3b0daecfeac0103aba8b293df07a0cbaf8b43f29 upstream. + +This uses calloc instead of doing the multiplication which might +overflow. + +Cc: stable@vger.kernel.org +Signed-off-by: Dave Airlie +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +@@ -940,8 +940,8 @@ static int kfd_ioctl_get_process_apertur + * nodes, but not more than args->num_of_nodes as that is + * the amount of memory allocated by user + */ +- pa = kzalloc((sizeof(struct kfd_process_device_apertures) * +- args->num_of_nodes), GFP_KERNEL); ++ pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures), ++ GFP_KERNEL); + if (!pa) + return -ENOMEM; + diff --git a/queue-5.15/series b/queue-5.15/series index bfb9dbcf543..fd3666d57f5 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -1,3 +1,4 @@ +amdkfd-use-calloc-instead-of-kzalloc-to-avoid-integer-overflow.patch net-dsa-fix-panic-when-dsa-master-device-unbinds-on-shutdown.patch wifi-ath9k-fix-lna-selection-in-ath_ant_try_scan.patch vmci-fix-memcpy-run-time-warning-in-dg_dispatch_as_h.patch -- 2.47.2