mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
drm/etnaviv: potential NULL dereference
The etnaviv_gem_prime_get_sg_table() is supposed to return error
pointers. Otherwise it can lead to a NULL dereference when it's called
from drm_gem_map_dma_buf().
Fixes: 5f4a4a73f4
("drm/etnaviv: fix gem_prime_get_sg_table to return new SG table")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
This commit is contained in:
parent
ef092dec04
commit
9e05352340
@ -15,7 +15,7 @@ struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj)
|
|||||||
int npages = obj->size >> PAGE_SHIFT;
|
int npages = obj->size >> PAGE_SHIFT;
|
||||||
|
|
||||||
if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */
|
if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */
|
||||||
return NULL;
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
return drm_prime_pages_to_sg(etnaviv_obj->pages, npages);
|
return drm_prime_pages_to_sg(etnaviv_obj->pages, npages);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user