Re: [PATCH 1/4] accel/rocket: Reject zero-sized BO creation
From: Sidong Yang
Date: Fri Dec 04 2026 - 11:53:30 EST
On Sat, Nov 28, 2026 at 03:38:41PM +0900, Sidong Yang wrote:
> When args->size is 0, drm_gem_shmem_create() succeeds with obj->size == 0.
> drm_gem_shmem_get_pages_sgt() then calls drm_gem_get_pages(), which
> returns ZERO_SIZE_PTR from kvmalloc_objs(..., 0), and passes it with
> n_pages = 0 to sg_alloc_append_table_from_pages(). That function
> unconditionally sets chunks = 1 and dereferences pages[0], crashing the
> kernel with a page fault on ZERO_SIZE_PTR.
Sorry, this is wrong. drm_gem_shmem_create() fails with -ENOSPC for a
zero size in drm_gem_create_mmap_offset(), so
drm_gem_shmem_get_pages_sgt() is not reached and nothing crashes. An
unpatched kernel returns ENOSPC here.
Hu Xinyao's patch makes the same change with the right description:
https://lore.kernel.org/r/2287DB0FF71AB8B8+1796018957.205946-1-huxinyao@xxxxxxxxxxxxxxx
Please drop this one. I'll send v2 of the series without it.
Thanks,
Sidong