mirror of
https://github.com/openbsd/src.git
synced 2026-04-29 08:36:22 +00:00
drm/amdgpu: Limit BO list entry count to prevent resource exhaustion
From Jesse.Zhang 5ce4a38e6c2488949e373d5066303f9c128db614 in linux-6.18.y/6.18.20 6270b1a5dab94665d7adce3dc78bc9066ed28bdd in mainline linux
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
#define AMDGPU_BO_LIST_MAX_PRIORITY 32u
|
||||
#define AMDGPU_BO_LIST_NUM_BUCKETS (AMDGPU_BO_LIST_MAX_PRIORITY + 1)
|
||||
#define AMDGPU_BO_LIST_MAX_ENTRIES (128 * 1024)
|
||||
|
||||
static void amdgpu_bo_list_free_rcu(struct rcu_head *rcu)
|
||||
{
|
||||
@@ -194,6 +195,9 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,
|
||||
const uint32_t bo_number = in->bo_number;
|
||||
struct drm_amdgpu_bo_list_entry *info;
|
||||
|
||||
if (bo_number > AMDGPU_BO_LIST_MAX_ENTRIES)
|
||||
return -EINVAL;
|
||||
|
||||
/* copy the handle array from userspace to a kernel buffer */
|
||||
if (likely(info_size == bo_info_size)) {
|
||||
info = vmemdup_array_user(uptr, bo_number, info_size);
|
||||
|
||||
Reference in New Issue
Block a user