On 10/10/26 10:37, Huang, Honglei wrote:
> 
> 
> On 10/10/2026 2:53 AM, Dmitry Osipenko wrote:
>> 24.09.2026 12:55, Honglei Huang пишет:
>>> +int virtio_gpu_userptr_create(struct virtio_gpu_device *vgdev,
>>> +                  struct drm_file *file,
>>> +                  struct virtio_gpu_object_params *params,
>>> +                  struct virtio_gpu_object **bo_ptr)
>>> +{
>>> +    struct virtio_gpu_object_userptr *userptr;
>>> +    struct virtio_gpu_mem_entry *ents = NULL;
>>> +    struct sg_table *sgt;
>>> +    struct mm_struct *mm;
>>> +    unsigned long lock_limit;
>>> +    unsigned long start;
>>> +    unsigned long end;
>>> +    s64 new_pinned;
>>> +    unsigned int nents;
>>> +    int ret;
>>> +
>>> +    *bo_ptr = NULL;
>>> +
>>> +    if (!params->size || !IS_ALIGNED(params->size, PAGE_SIZE) ||
>>> +        params->userptr != (unsigned long)params->userptr)
>>> +        return -EINVAL;
>>> +
>>> +    start = params->userptr;
>>> +    if (!IS_ALIGNED(start, PAGE_SIZE) ||
>>> +        check_add_overflow(start, (unsigned long)params->size, &end))
>>> +        return -EINVAL;
>>
>> There is new vgdev->blob_alignment defining host page size as it may
>> differ from guest's page. Will be good to validate both.
>>
> 
> Will add blob_alignment check in next version, thanks for the review.
Missed that verify_blob() already should be validating the userptr
blob_alignment. The patches look good.

BTW, previously the extra AMD KFD patches were needed on host kernel,
did they land upstream?

-- 
Best regards,
Dmitry

Reply via email to