1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

drm/amdgpu: check num_entries in GEM_OP GET_MAPPING_INFO

From Ziyi Guo
f059b4c493df3e54fe3ffe4658009c31864275da in linux-6.18.y/6.18.35
a1ba4594232c87c3b8defd6f89a2e40f8b08395d in mainline linux
This commit is contained in:
jsg
2026-06-10 00:21:35 +00:00
parent b22720d7a7
commit 233b85f5b4
+5
View File
@@ -1194,6 +1194,11 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
* If that number is larger than the size of the array, the ioctl must
* be retried.
*/
if (args->num_entries > INT_MAX / sizeof(*vm_entries)) {
r = -EINVAL;
goto out_exec;
}
vm_entries = kvcalloc(args->num_entries, sizeof(*vm_entries), GFP_KERNEL);
if (!vm_entries) {
r = -ENOMEM;