mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
asahi: Fix lseek failure error handling in agx_bo_import().
If bo->size = lseek(); would return a failure value of bo->size ==-1,
then current error handling would return while leaving the already
allocated and cached bo for the dmabuf fd in a half initialized "zombie"
state. On a successive call to agx_bo_import() for the same fd, the
assigned bo->size == -1 would mark the bo as "already initialized",
just bumping its reference count, and then returning a dysfunctional
bo to the caller, leasing to followup failures elsewhere.
Use goto error; instead, where "error:" handling will zero-out the bo,
marking it as effectively uninitialized, and hopefully causing proper
initialization on a successive call to agx_bo_import().
Fixes: df725d4f64 ("asahi: remove agx_bo::dev")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37538>
This commit is contained in:
parent
d041640b88
commit
3c01205e32
1 changed files with 1 additions and 2 deletions
|
|
@ -283,8 +283,7 @@ agx_bo_import(struct agx_device *dev, int fd)
|
|||
* for zero sized maps and fail nicely too
|
||||
*/
|
||||
if ((bo->size == 0) || (bo->size == (size_t)-1)) {
|
||||
pthread_mutex_unlock(&dev->bo_map_lock);
|
||||
return NULL;
|
||||
goto error;
|
||||
}
|
||||
if (bo->size & (AIL_PAGESIZE - 1)) {
|
||||
fprintf(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue